Simple/efficient text compression
What's the simplest, but efficient compression algorithm?
Deflate, lzma, etc. aren't valid options. I need something that compiles really small, like: RLE, LZX, Huffman, etc..
Note: The data is 95% ASCII text
Edit: Data开发者_开发百科 is ~20kb at the moment, but i expect it to grow up to 1mbEdit2:
Other interesting options smaz https://github.com/antirez/smaz FastLZ http://fastlz.org/It sounds like LZO was designed to meet your requirements:
- Decompression is simple and very fast.
- Requires no memory for decompression.
- Compression is pretty fast.
Something BWT-based would be probably good for this case.
http://en.wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transform
It compresses text much better than LZs, and is easy to implement from scratch,
and there're good libraries.
http://libbsc.com
http://encode.ru/threads/104-libBWT?p=22903&viewfull=1#post22903
http://code.google.com/p/libdivsufsort/
Or, alternatively, there's ppmd which is used for text compression in
rar/winzip/7-zip etc, but its more complicated.
http://www.compression.ru/ds/ppmdj1.rar
http://www.compression.ru/ds/ppmsj.rar (faster/small memory usage)
http://www.ctxmodel.net/files/PPMd/ppmd_Jr1_sh8.rar (alternative port)
you could try http://scz-compress.sourceforge.net/
This benchmark has a lot of comparisons. Check it out as it shows you also the algorithms used in the compression process.
Most dictionary schemes will do nicely. Any of the LZs. We use an LZ77 varient on embedded systems for a lot of our simple compression stuff and it works beautifully with almost no memory overhead. What kind of system is compressing and what is decompressing? That will determine the type of compressor you can get away with.
精彩评论