[issue22789] Compress the marshalled data in PYC files

Antoine Pitrou report at bugs.python.org
Tue Nov 4 11:39:59 CET 2014


Antoine Pitrou added the comment:

Ok, comparison between zlib/snappy/lz4:

$ python3.4 -m timeit -s "import zlib; data = zlib.compress(open('Lib/__pycache__/threading.cpython-35.pyc', 'rb').read()); print(len(data))" "zlib.decompress(data)"
10000 loops, best of 3: 181 usec per loop

$ python3.4 -m timeit -s "import snappy; data = snappy.compress(open('Lib/__pycache__/threading.cpython-35.pyc', 'rb').read()); print(len(data))" "snappy.decompress(data)"
10000 loops, best of 3: 35 usec per loop

$ python3.4 -m timeit -s "import lz4; data = lz4.compress(open('Lib/__pycache__/threading.cpython-35.pyc', 'rb').read()); print(len(data))" "lz4.decompress(data)"
10000 loops, best of 3: 21.3 usec per loop

Compressed sizes for threading.cpython-35.pyc (the file used above):
- zlib: 14009 bytes
- snappy: 20573 bytes
- lz4: 21038 bytes
- uncompressed: 38973 bytes

Packages used:
https://pypi.python.org/pypi/lz4/0.7.0
https://pypi.python.org/pypi/python-snappy/0.5

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22789>
_______________________________________


More information about the Python-bugs-list mailing list