Adding files immediately to the zip file

Sep 11, 2009 at 3:21 PM

My program copies few thousands small files on the hard disk and adds many of them to a zip file. If I understand it correctly, only with Save() get all files written to the zip file. Wouldn't it be better for the performance if a file gets immediately written to the zip file? Because of the copy, the file content is already somewhere in the RAM. But if it is written to the zip file only much later, of course it has to be read again from the harddisk.

What is the reason that files don't get added immediately ?

Would there be a speed advantage adding them immediately ?

Can files get added immediately with the existing code ?

Thanks for your great work. Even more amazing that you answer all these questions. Appreciated.

 

Coordinator
Sep 11, 2009 at 3:31 PM

> What is the reason that files don't get added immediately ?

This is the design of the ZipFile class.

> Would there be a speed advantage adding them immediately ?

I don't know.  You could build your own ZipFile class that saves immediately, and compare.

> Can files get added immediately with the existing code ?

No.  the design of the class writes them at the end.

Are you having performance issues?

Sep 11, 2009 at 11:58 PM

Thanks for the quick response.

I still wonder what is the design reason why the ZipFile class does not add the files immediately but stores their location first, then adds them all in one go.

PS: I haven't started my project yet. My guess is that ZipFile is fast enough as it is. Since I am new with ZipFile, I thought I better ask first, code later :-)