Skip to main content

LZ4 Bindings for Python

Project description

(former python-lz4)

https://travis-ci.org/sigman78/python-lz4.svg?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 lz4

Usage

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.146867s

Important 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…)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lz4ext-0.7.3.zip (34.3 kB view details)

Uploaded Source

Built Distribution

lz4ext-0.7.3-cp27-none-win32.whl (16.9 kB view details)

Uploaded CPython 2.7 Windows x86

File details

Details for the file lz4ext-0.7.3.zip.

File metadata

  • Download URL: lz4ext-0.7.3.zip
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lz4ext-0.7.3.zip
Algorithm Hash digest
SHA256 e6a55a9c0c06942e13a398b140d653692f916f584fd27c815e14c331e532b377
MD5 60be3bf1de5318f56538cd3039c752b9
BLAKE2b-256 270c8763efa00944162ecfc4e21674ffbb7ea4c772cf32a71fe96b1285ee41fa

See more details on using hashes here.

File details

Details for the file lz4ext-0.7.3-cp27-none-win32.whl.

File metadata

File hashes

Hashes for lz4ext-0.7.3-cp27-none-win32.whl
Algorithm Hash digest
SHA256 e6e0eb261ac734bbc7643b4f0fc0004af86153731369987f0aa7eb5390261205
MD5 3e2f956dccd382eab55543c661ece04a
BLAKE2b-256 eeae2e45934e82329e118c8d86ce7abcd08342f48cb46663a6a93980ba02181c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page