#9201 closed patch
Hash map for ZipArchive class
Reported by: | dreammaster | Owned by: | sev- |
---|---|---|---|
Priority: | normal | Component: | --Other-- |
Version: | Keywords: | ||
Cc: | Game: |
Description
I'd to submit some changes I've made to the unzip.cpp file class, to add a hash map of the file list, for peer review before committing it. The current sequential file search (done in unzLocateFile) is particularly problematic for the Broken Sword 2.5 engine, since the main Zip file is 700Mb in size, and each call to the method can take a second to run even on a fast computer. Not only that, but for a typical file access, the method gets called three times: Once in a call the engine makes to see if the file exists (this could have been re-factored) A second time when an ArchiveMemberPtr is created to the file And finally a third time when the member is accessed to actually read the contents of the file.
I've wrapped my changes in several '#ifdef ZIP_HASH' blocks, so the old behavior could still be used if there's ever any need to disable it.
Ticket imported from: #3048388. Ticket imported from: patches/1306.
Attachments (1)
Change History (4)
by , 14 years ago
Attachment: | unzip_cpp.patch added |
---|
comment:1 by , 14 years ago
Owner: | set to |
---|---|
Status: | new → closed |
comment:2 by , 14 years ago
Excellent! That is what needed. I do not see a point in keeping old behavior, in fact caching should've been implemented from the beginning.
Committed without ZIP_HASH defines.
comment:3 by , 6 years ago
Component: | → --Other-- |
---|
Patch file for common/unzip.cpp