Hello, i'm writing project that stores data, so i need to compress it. I've tried zlib but it's bottleneck of my project. So maybe there is faster solution. I don't need a great compress ratio, but i'm looking for really fast compression. Are there any other data compression libraries except zlib, that are really free and can be used in proprietary software (project, i'm working on, isn't GPL-based). My project is on C++ and I need to compress char* arrays of text.
A very fast compression algorithm is LZO. Benchmarks on the site show that decompression is comparable in speed to memcpy()
.
The free version of LZO is GPL licensed, but there is also a commercial version of the library in LZO Professional. Also, from the documentation:
Special licenses for commercial and other applications which are not willing to accept the GNU General Public License are available by contacting the author.
Since you need something that is quick but not necessarily the best compression ever, you might consider a library that does RLE (run-length encoding) compression. One implementation is librle, which is under the BSD license, which is pretty permissible for proprietary use.
Another answer already mentions LZO
, which is sort of the default "I need faster (de)compression" solution.
Another one I've found is liblzf. Pretty close to LZO
in terms of speed and compression rates. LZO
has a GPL license, whereas liblzf
has a BSD license (which, IMHO, is an advantage).
Intel Integrated Performance Primitives has samples that implements variety of compressions:
- bzip2-compatible library The ipp_bzip2 sample demonstrates how to use Intel IPP Data Compression domain functions for implementation of bzip2/libbzip2 (a program and library for lossless, block-sorting data compression and new improvements on threading optimization for bzip
- GZIP-compatible library The IPP_GZIP sample illustrates the way of implementing effective lossless data compression solution by using Intel IPP Data Compression domain API. Additionally, this sample shows the ways of parallelizing application using OpenMP and other methods to advanced benefits on multi-core environment.
- zlib-compatible library (new!) This code sample illustrates how to build a zlib-compatible data compression library using the optimized LZ77 and Huffman coding functions in Intel IPP.
- General data compression examples Illustrates how to use functions provided by the Intel IPP data compression domain. Includes Huffman encoding/decoding, RLE encoding/decoding, MoveToFront (MTF), Burrows-Wheeler Transformations (BWT), General Interval Transform (GIT), and Lempel-Ziv-Storer-Szymanski (LZSS) functions.
IPP is not free, but it really fast. It supports Windows and Linux.
Here are a few:
FastLZ -- fast and lightweight, MIT license unless you want to use it under a GPL license
LZJB -- also fast and pretty lightweight, used as default compression algorithm for Sun's ZFS
I'm doing a nonGPL hardware project and I need a compression algorithm that is very fast, offers relatively good compression and has minimal memory requirements. LZO fits the bill perfectly.
Two questions:
- Anyone knows the ballpark figure for commercial LZO licences?
- There has been some debate on which algorithms offer good compression and fast decompression, but no talk about minimal memory requirements. Any ideas?
I have used a LZSS implementation from Haruhiko Okumura. The licensing is not clear from his site but some versions was released with a "Use, distribute, and modify this program freely" line included and the code is used freely by commercial vendors.
Another option could be the lzfx lib that implement LZF. It is released under a BSD Licence.