mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
Recent ZipArchive changes destroy performance on all non-zip archives #72
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @benshoof on GitHub (Dec 15, 2015).
A critical bug has been recently introduced that causes SharpCompress to read and process the entirety of all non-zip archives when opening them. This affects both Archive and Reader APIs.
0f12a073afcauses ZipArchive.IsZipFile() to scan the entire archive looking for a zip header instead of returning immediately after not finding it at the start. Since the first thing that ArchiveFactory.Open() and ReaderFactory.Open() do is call ZipArchvie.IsZipFile(), all non-zip archives pay this price. Even worse, the header search is CPU bound so it takes much longer than simply reading the entire file. Zip files open quickly though since they pass the test right away. The committer probably only tested this on zip files and small non-zip files.This commit needs to be reverted.
@adamhathcock commented on GitHub (Dec 15, 2015):
Can you do this for me? I'm fighting fires at work.