-
Notifications
You must be signed in to change notification settings - Fork 1
Home
David Hill edited this page Jul 18, 2013
·
2 revisions
The shrink library provides a single API into several compression algorithms. It enables developers to easily add compression and decompression functionality to an existing code base. Currently it supports:
All these fine algorithms have pros and cons. LZO is the fastest by an order of magnitude but trades of compression ratio for speed. LZ77 is the middle of the road on both speed and compression ration. LZMA is slow but compresses the best.The idea of this library is to provide an app writer with the capability of using any compression/decompression algorithm without having to understand the intricate parts. Now there is no excuse to not add compression to any code!
if (s_init(S_ALG_LZO, S_L_MID)) errx(1, "s_init algorithm %d not supported", algo); /* compress */ if (s_compress(source, destination, size, &comp_sz, NULL)) { errx(1, "s_compress failed"); /* decompress */ if (s_decompress(source, destination, comp_sz, &uncomp_sz, NULL)) errx(1, "s_decompress failed");
That's it!
- Snapshots
- Mailing lists
- shrink-commits
- subscribe: email shrink-commits+subscribe at opensource.conformal.com
- unsubscribe: email shrink-commits+unsubscribe at opensource.conformal.com
- shrink-commits
The following results were obtained on a laptop running the shrink test program.
All zeroes:
$ shrink algorithm : null compression bounds : 10485760 data size : 10.0MB size compressed : 10.0MB compression : 14.729ms compression throughput : 679MB/s decompression : 13.864ms decompression throughput : 721MB/s algorithm : lzo1x_1 compression bounds : 11141187 data size : 10.0MB size compressed : 40.2KB compression : 12.195ms compression throughput : 820MB/s decompression : 26.214ms decompression throughput : 382MB/s algorithm : lzo1x_1_15 compression bounds : 11141187 data size : 10.0MB size compressed : 40.2KB compression : 12.221ms compression throughput : 818MB/s decompression : 28.081ms decompression throughput : 356MB/s algorithm : lzo1x_999 compression bounds : 11141187 data size : 10.0MB size compressed : 55.0KB compression : 155.321ms compression throughput : 64.4MB/s decompression : 26.511ms decompression throughput : 377MB/s algorithm : lzw_1 compression bounds : 10488971 data size : 10.0MB size compressed : 44.7KB compression : 62.852ms compression throughput : 159MB/s decompression : 20.185ms decompression throughput : 495MB/s algorithm : lzw_6 compression bounds : 10488971 data size : 10.0MB size compressed : 10.0KB compression : 122.834ms compression throughput : 81.4MB/s decompression : 35.314ms decompression throughput : 283MB/s algorithm : lzw_9 compression bounds : 10488971 data size : 10.0MB size compressed : 10.0KB compression : 122.840ms compression throughput : 81.4MB/s decompression : 34.236ms decompression throughput : 292MB/s algorithm : lzma_0 compression bounds : 10486912 data size : 10.0MB size compressed : 1.6KB compression : 145.246ms compression throughput : 68.8MB/s decompression : 39.631ms decompression throughput : 252MB/s algorithm : lzma_6 compression bounds : 10486912 data size : 10.0MB size compressed : 1.6KB compression : 165.282ms compression throughput : 60.5MB/s decompression : 41.318ms decompression throughput : 242MB/s algorithm : lzma_9 compression bounds : 10486912 data size : 10.0MB size compressed : 1.6KB compression : 180.884ms compression throughput : 55.3MB/s decompression : 45.484ms decompression throughput : 220MB/s
Pure random data:
$ shrink -r algorithm : null compression bounds : 10485760 data size : 10.0MB size compressed : 10.0MB compression : 14.695ms compression throughput : 681MB/s decompression : 13.936ms decompression throughput : 718MB/s algorithm : lzo1x_1 compression bounds : 11141187 data size : 10.0MB size compressed : 10.0MB compression : 202.993ms compression throughput : 49.3MB/s decompression : 13.979ms decompression throughput : 715MB/s algorithm : lzo1x_1_15 compression bounds : 11141187 data size : 10.0MB size compressed : 10.0MB compression : 205.179ms compression throughput : 48.7MB/s decompression : 13.734ms decompression throughput : 728MB/s algorithm : lzo1x_999 compression bounds : 11141187 data size : 10.0MB size compressed : 10.0MB compression : 2.328s compression throughput : 4.3MB/s decompression : 13.891ms decompression throughput : 720MB/s algorithm : lzw_1 compression bounds : 10488971 data size : 10.0MB size compressed : 10.0MB compression : 482.057ms compression throughput : 20.7MB/s decompression : 22.704ms decompression throughput : 441MB/s algorithm : lzw_6 compression bounds : 10488971 data size : 10.0MB size compressed : 10.0MB compression : 501.323ms compression throughput : 19.9MB/s decompression : 23.784ms decompression throughput : 421MB/s algorithm : lzw_9 compression bounds : 10488971 data size : 10.0MB size compressed : 10.0MB compression : 503.223ms compression throughput : 19.9MB/s decompression : 22.671ms decompression throughput : 441MB/s algorithm : lzma_0 compression bounds : 10486912 data size : 10.0MB size compressed : 10.0MB compression : 3.431s compression throughput : 2.9MB/s decompression : 30.481ms decompression throughput : 328MB/s algorithm : lzma_6 compression bounds : 10486912 data size : 10.0MB size compressed : 10.0MB compression : 4.675s compression throughput : 2.1MB/s decompression : 28.269ms decompression throughput : 354MB/s algorithm : lzma_9 compression bounds : 10486912 data size : 10.0MB size compressed : 10.0MB compression : 5.174s compression throughput : 1.9MB/s decompression : 32.696ms decompression throughput : 306MB/s