From EDM2
Jump to: navigation, search

A run time compression C library that offers fairly moderate compression in return for high compression speeds and in particular class leading decompression speeds, the library also comes with the LZ4_HC variant that gives better compression ratios and even higher decompression speeds at the cost of lousy compression speeds. Intended to be used for internal data compression in databases and similar applications rather than file compression, but in those sort of cases a low load decompression can in addition to saving space actually speed up reading and writing to and from slow peripherals such as hard drives.

Bindings and translations to other programming languages

There is a number of bindings and/or ports/re-implementations available of the LZ4 library, amongst others, Assembly language (x86, reimplementation), C++ (Reimplementation), Haskell (Binding), Java (Reimplementation), Lua (Binding), ECMAScript (Binding + decompresser reimplementation), Pascal (Delphi wrapper and reimplementation), Perl (Binding), PHP (Binding), Python (Binding), Ruby (Binding) and Smalltalk (Binding).

The C++ reimplementation is particularly good but will only compile on OS/2 with the newest GCC so in most cases the original C lib is a better fit. No official LISP port or bindings appear to exist, however LZ4 bindings have appeared in the "Steel Bank Common Lisp" distribution that appear generic enough that you can probably easily port the over to your favourite LISP environment, take a look at this Github commit.

The LZ4 C library appears to compile fairly cleanly on OS/2 with the usual caveats about compiler and system differences and so on, and is in fact used in a number of open source projects on eComStation. However when it comes to foreign language bindings and ports you may for some of them need to do some additional work since some of the common Windows and Unix like implementations differ quite a bit from the OS/2 ones and a number of the current OS/2 implementations are getting quite old, the Java ports run like a charm though. In fact the library is written entirely in C with no in-line assembly and generic enough to be easily portable to most systems, although on single tasking systems like DOS they make little sense unless you are using something like TopSpeed C that can actually create DOS threads.


See also

  • Snappy - Similar C++ library
  • LZO - Similar C library although much slower decompression


License and status


  • Yann Collet (Original author)
  • Adrien Grand (Java port)
  • Pierre Curto (ECMAScript port)
  • Takayuki Matsuoka (C++ port)
  • Christopher Jackson (Python binding)
  • Hanno Hugenberg (Delphi wrapper)
  • Jose Pascoa (Pascal port)
  • Steeve Morin (Alternative Python bindings)
  • Komiya Atsushi (Ruby bindings)
  • KJDev (PHP port)
  • Christophe Delord (Lua bindings)
  • Mark Wotton (Haskell bindings)
  • Mariano Martinez (Smalltalk bindings)
  • Binglin Chang (Java/JNI bindings)
  • Jim Leonard (x86 assembly)