Skip to main content

LZ4 Bindings for Python

Project description

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 lz4

Usage

The library is pretty simple to use:

>>> import lz4
>>> compressed_data = lz4.dumps(data)
>>> data == lz4.loads(compressed_data)
True
>>>

Methods

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
>>>

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

https://cruel-carlota.pagodabox.com/d37459f4fce98f2983589a1c1c23a4e4

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

lz4-0.6.1.tar.gz (19.8 kB view details)

Uploaded Source

File details

Details for the file lz4-0.6.1.tar.gz.

File metadata

  • Download URL: lz4-0.6.1.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lz4-0.6.1.tar.gz
Algorithm Hash digest
SHA256 590d1dca53b743e7fc38190fa674b20eea87d793a70910984ff58a6f6cf20160
MD5 f607af73d9b8c501d72f41cd74a3137e
BLAKE2b-256 393b652c0ccec9cfbeab09ff2766d463fe13ff190dee0f945b1ce38804d589e6

See more details on using hashes here.

Supported by

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