Decompressing zip files with C#

Friday, August 22, 2008 , 7 Comments

Which is the fastest way to decompress ZIP files (fragments actually) using C#?

I tried with SharpZipLib vs vs a wrapper on top of zlib 1.2.3.

Which one is faster?

I tried with the same test file, repeating 1000 times and these are the results:

$ time mono unzip.exe file ziplib 1000

real 0m4.491s
user 0m4.392s
sys 0m0.119s

$ time mono unzip.exe file sharp 1000

real 0m3.631s
user 0m3.550s
sys 0m0.090s

$ time mono unzip.exe file zlib 1000

real 0m1.754s
user 0m1.684s
sys 0m0.079s

Clear, right?

So, the zlib wrapper is two times faster than SharpZipLib which, in turn, is faster than

For zlib wrapper I just called the uncompress method.

With SharpZipLib I used InflaterInputStream

InflaterInputStream st = new InflaterInputStream(file, new Inflater(true));

and for zlib.NET

zlib.ZOutputStream outZStream = new zlib.ZOutputStream(outStream);

Hope it helps!

We develop Plastic SCM, a version control that excels in branching and merging, can deal with huge projects and big binary assets natively, and it comes with GUIs and tools to make everything simpler.

If you want to give it a try, download it from here.

We are also the developers of SemanticMerge, and the gmaster Git client.


  1. Hi,

    I tried with both small files (28Kb) and then a big number of text and binary files (about 3000), and zlib seems to be always faster

  2. Sounds normal.

    Where can one get your zlib binding?

  3. Hi,

    You should try the 7zip C# lib too. I'm not sure if its faster, or not, but I'm sure I've been pretty satisfied with its results compressing a Webservice requests and responses in real-time to some huge resultsets (up to 10MB of data each).


  4. Hi,

    If you can use a GPL library, you can take a look at:

  5. Hi Alexandre,

    Thanks! I'll try to find the 7zip lib!

  6. Sorry about that, forgot the link :P