.NET P/Invoke wrapper for Snappy, fast compression library
Original sources: http://code.google.com/p/snappy/
More up-to-date implementation: http://snappy.angeloflogic.com/
Fast compression algorithm
Snappy is designed to do both fast compression and decompression. It is advertised as 250MB/s compression and 500MB/s decompression on i7 64-bit. It sacrifices some compression ratio to achive this, of course.
Using Silesia Corpus
for testing it scored (MS Windows 7 Home Premium 64-bit SP1, Intel Core 2 Duo E8400 @ 3.00GHz, 8.00 GB Dual-Channel DDR3 @ 666MHz (9-8-8-20)):
- snappy: 200MB/s compression, 550MB/s decompression, 49% compression ratio
- zip: ~6MB/s compression, ~45MB/s decompression, 31% compression ratio
(note, this results are for illustration only, the times were not accurately measured. It just should give you idea)
As the license of original version says: "Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission."
I can't tell who uses it but you can google it. Oops, I did it again.
Snappy's sources has been recompiled using VC++ 2010. As they were optimized for GCC I needed slight alteration to implement __builtin_clz
with VC++'s _BitScanReverse
A C# wrapper has been added on top of it. Wrapper itself (SnappyPI.dll
) is "AnyCPU" but selects correct DLL on runtime, so it's preferable to distribute both versions of DLL: SnappyDL.x86.dll
Actually this wrapper is just a spin-off of LZ4
library which I'm working on. I just needed Snappy to compare performance. In fact, is seems like LZ4 is faster and offers better compression ratio, at least for out-of-the-box settings. You can see it for yourself here
There are two other implementations of Snappy: this one
and this one
. I didn't check as they were both "safe" implementations and I needed native one. Edit
: It seems that they are both not finished.