This project is read-only.

GZip performance in comparison to zlib

Mar 30, 2011 at 4:42 PM


I tested the performance of DotNetZip.GZipStream with CompressionLevel "BestSpeed" and native zlib.

The size of compressed file is the same, but zlib needs 14s and DotNetZip 34s.  

Is there any possibility to speed up performance?

Thanks in advance.

Mar 30, 2011 at 5:56 PM

Well it depends on the test.  Sometimes in perf tests you want to measure a 1-time transaction - "how long will it take to do X once?"  Other times, in particular when testing for server scenarios, you want to test more-or-less continuous performance.  "How long will it take to do X 10,000 times?"  When testing this, the test needs to perform a "warm up" period before the measuring interval.  In a one-time test, DotNetZip will likely lag a native implementation by some significant amount. I never measured DotNetZip against zlib, but your quoted figures don't surprise me.  

One thing I noticed is that .NET assemblies (including DotNetZip) compiled with the "debug" option are significantly slower than those compiled without "debug".  Check which version of DotNetZip you are using, and also check your own .NET application.  This is one sure way to speed up a .NET assembly: compile it as an optimized binary.

As for other optimizations - I don't have any good ideas. 


Mar 31, 2011 at 9:30 AM

Pity! I already used the "Optimized code" option and release version of my assembly and DotNetZip.