SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Slow compression

Last post 08-07-2008 5:35 PM by dragon-fly999. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 08-03-2008 6:26 PM

    Slow compression

    Hi,

    My program uses the ZipOutputStream class to compress 8,500 files and the total size of the files is 564 MB.  The output zip file size is 42 MB.  My program basically does 2 things.  When the program starts, it takes about 6 minutes to create the 8,500 files.  After that, the files get compressed into a zip file.  The strange thing is that it takes more than 4 minutes to compress the 8,500 files.  During the compression, the CPU usage is very low (which is not what I expected).

    I then decided to copy the compression code from my "real" program to a test program.  Note that the test program only does the compression.  It took the test program 22 seconds to zip up 8,500 files.  During the compression, the CPU usage was high (which is what I expected).  Does anyone have a theory of what the problem is? Thank you.
  • 08-03-2008 11:16 PM In reply to

    Re: Slow compression

    Hi,

    No theories as such but it may help to trigger you by stating the obvious.  The code is spending time doing something other than compression.  What else could your code be doing?

    hth, -jr-

  • 08-04-2008 1:46 PM In reply to

    Re: Slow compression

    Hi John,

    I checked again and my program is single-threaded and it does 2 things:

    (1) Create the 8,500 files.

    (2) Zip up the 8,500 files using the ZipOutputStream.

    I should mention that step 1 above is CPU intensive and tons of objects get created/destroyed.  I'm new to C# and was wondering if that would somehow (GC??) cause step 2 to run slower.  The most puzzling thing to me was the low (i.e. less than 5%) CPU usage during step 2.  Thank you.

  • 08-04-2008 2:49 PM In reply to

    Re: Slow compression

     If the CPU usage is so low, then the CPU is waiting for something else - most likely disk IO.

    Daniel Grunwald
  • 08-06-2008 3:16 PM In reply to

    Re: Slow compression

    I ran the exact same test on Windows 2003 Server (as opposed to Windows XP Professional) and everything worked properly.  Strange?!?
  • 08-07-2008 11:58 AM In reply to

    Re: Slow compression

    Hi,

    Its only strange when the reasons arent clear.  But of course this is windows so strange things to happen :-)  At least its not Vista which is a downgrade in terms of speed regardless :-(

    You dont have network drives on the XP machine by any chance?  File access across networks can sometimes go very awry and take ages. I have had issues with that kind of thing in the past.

    hth, -jr-

  • 08-07-2008 5:35 PM In reply to

    Re: Slow compression

    No network drives on the XP machine.  I redesigned my program a little and now things work fine.  There's really no reason for my program to first create the 8,500 files and then zip them up.  My program now does the following:

    (1) Create a file (and the file is not written to disk).

    (2) Write the file to the zip output stream.

    (3) Repeat step (1) and (2) until all the files are processed.

     Thank you all for your help.

Page 1 of 1 (7 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.