A wrapper for gzip and pigz in python
Project description
Pigz wrapper
This repository is a wrapper for python to utilize gzip or pigz to compress or decompress data in parallel.
For installation:
python setup.py install
For reading:
from pigz import PigzFile
with PigzFile("input.gz") as f:
for line in f:
print(line)
For writing:
from pigz import PigzFile
threads = 4 # default
with PigzFile("output.gz", "wt", threads) as fw:
for line in lines:
fw.write(line)
For testing:
python setup.py test
the output is as follows:
============================================================
Read by gzip subprocess:
Number: 1, Time: 585.19 ms
Number: 2, Time: 726.82 ms
Number: 3, Time: 698.48 ms
Number: 4, Time: 728.64 ms
Number: 5, Time: 698.70 ms
Average time: 687.57 ms
============================================================
Write by gzip subprocess:
Number: 1, Time: 13652.26 ms
Number: 2, Time: 13413.61 ms
Number: 3, Time: 13303.46 ms
Number: 4, Time: 13369.65 ms
Number: 5, Time: 13340.88 ms
Average time: 13415.97 ms
============================================================
Read by pigz subprocess (4 threads):
Number: 1, Time: 339.37 ms
Number: 2, Time: 403.47 ms
Number: 3, Time: 401.11 ms
Number: 4, Time: 408.30 ms
Number: 5, Time: 425.89 ms
Average time: 395.63 ms
============================================================
Write by pigz subprocess (4 threads):
Number: 1, Time: 3562.05 ms
Number: 2, Time: 3511.68 ms
Number: 3, Time: 3519.51 ms
Number: 4, Time: 3518.98 ms
Number: 5, Time: 3513.09 ms
Average time: 3525.06 ms
============================================================
Read by gzip package:
Number: 1, Time: 867.79 ms
Number: 2, Time: 915.57 ms
Number: 3, Time: 893.22 ms
Number: 4, Time: 885.66 ms
Number: 5, Time: 889.74 ms
Average time: 890.40 ms
============================================================
Write by gzip package:
Number: 1, Time: 66520.40 ms
Number: 2, Time: 66305.25 ms
Number: 3, Time: 65591.92 ms
Number: 4, Time: 65327.56 ms
Number: 5, Time: 65716.15 ms
Average time: 65892.26 ms
The pigz subprocess show significantly high effectiveness in compressing and decompressing data.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pygz-1.0.1.tar.gz
(3.2 kB
view details)
Built Distribution
pygz-1.0.1-py3-none-any.whl
(4.0 kB
view details)
File details
Details for the file pygz-1.0.1.tar.gz
.
File metadata
- Download URL: pygz-1.0.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.61.2 importlib-metadata/1.7.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 059225a30ddcea55fa238d0ce416fc738c5c70e7e455764a7dade4e4a8680e21 |
|
MD5 | 459328c21aae900b3784272ff0a0acae |
|
BLAKE2b-256 | b63603f9069786e837d2f8d4cd20c2458bf890a083e68fbbf75b48f56cb95b26 |
File details
Details for the file pygz-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: pygz-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.61.2 importlib-metadata/1.7.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | faf5edd33460a5a98ce5d7c0ebb7643a2a279e5801e2947b9e2d699abedbc85a |
|
MD5 | 624a760a61a53cb2dd65588eb13f27c7 |
|
BLAKE2b-256 | d1dcaa3b7628a40045b7f843343acdf27e323c73d17919544ea5e4c62b68476f |