miniz (was here, now migrating to github here) is my single source file zlib-alternative. It's a complete from scratch reimplementation, and my 5th Deflate/Inflate implementation so far. It has an extremely fast, real-time Deflate-compatible compressor, and for fun the entire decompressor lives in only a single C function. From this post by Tom Alexander:
miniz vs zlib
For this final test, we will use the code from the above test which is using
read
and only a single thread. This should be enough to compare the raw performance of miniz vs zlib by comparing our binary vs zcat.Type | Time |
---|---|
fzcat (modified for test) | 64.25435829162598 |
zcat | 109.0133900642395 |
Conclusions
So it seems that the benefit of
mmap
vs read
isn't as significant as I expected. THe benefit theoretically could be more significant on a machine with multiple processes reading the same file but I'll leave that as an excercise for the reader.miniz turned out to be significantly faster than zlib even when both are used in the same fashion (single threaded and read). Additionally, using the copious amounts of ram available to machines today allowed us to speed everything up even more with threading.