- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.2k
Open
Labels
area-System.IO.CompressionenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorstenet-performancePerformance related issuePerformance related issue
Milestone
Description
When you open a ZipArchive in Update mode, the entire zip file will be loaded in memory when the .Dispose method is invoked.
This is because .Dipose  calls .WriteFile, which:
- Calls LoadLocalHeaderExtraFieldAndCompressedBytesIfNeededfor all entries, which loads the compressed data into memory for those entries
- Sets the size of the .zip archive to 0, by calling _archiveStream.SetLength(0);
- Writes out all entries one by one.
As a result:
- A lot of memory is used, the compressed data for each entry is loaded into memory
- A lot of unnecessary disk I/O is performed, because all entries are written out again, even if they were not modified.
An alternative may be to incrementally update the zip archive, and only update entries which changes.
jakubsuchybio, TimSirmovics, krolson, cremor, vansha and 6 more
Metadata
Metadata
Assignees
Labels
area-System.IO.CompressionenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorstenet-performancePerformance related issuePerformance related issue