Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/steeve/python-lz4
LZ4 bindings for python
https://github.com/steeve/python-lz4
Last synced: 4 days ago
JSON representation
LZ4 bindings for python
- Host: GitHub
- URL: https://github.com/steeve/python-lz4
- Owner: steeve
- Created: 2012-01-31T11:06:45.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2016-03-02T19:01:32.000Z (almost 9 years ago)
- Last Synced: 2025-01-01T13:26:58.592Z (6 days ago)
- Language: C
- Homepage: http://github.com/steeve/python-lz4
- Size: 426 KB
- Stars: 105
- Watchers: 13
- Forks: 31
- Open Issues: 22
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
==========
python-lz4
==========.. image:: https://secure.travis-ci.org/steeve/python-lz4.png?branch=master
Overview
========
This package provides bindings for the `lz4 compression library `_ by Yann Collet.Code specific to this project is covered by the `BSD 3-Clause License `_
Install
=======
The package is hosted on `PyPI `_::$ pip install lz4
$ easy_install lz4Usage
=====
The library is pretty simple to use::>>> import lz4
>>> compressed_data = lz4.dumps(data)
>>> data == lz4.loads(compressed_data)
True
>>>Methods and Constants
=====================
The bindings provides some aliases too::>>> import lz4
>>> lz4.LZ4_compress == lz4.compress == lz4.dumps
True
>>> lz4.LZ4_uncompress == lz4.uncompress == z4.decompress == lz4.loads
True
>>> lz4.VERSION == lz4.__version__ # e.g. "0.7.0"
True
>>>Is it fast ?
============
Yes. Here are the results on my 2011 Macbook Pro i7 with lz4.c as input data: ::$ python tests/bench.py
Data Size:
Input: 24779
LZ4: 10152 (0.41)
Snappy: 9902 (0.40)
LZ4 / Snappy: 1.025247
Benchmark: 200000 calls
LZ4 Compression: 9.737272s
Snappy Compression: 18.012336s
LZ4 Decompression: 2.686854s
Snappy Decompression : 5.146867sImportant note
==============
Because LZ4 doesn't define a container format, the python bindings will insert the original data size as an integer at the start of the compressed payload, like most bindings do anyway (Java...).. image:: https://cruel-carlota.pagodabox.com/d37459f4fce98f2983589a1c1c23a4e4