Opened 14 years ago

Closed 14 years ago

Last modified 6 years ago

#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)

unzip_cpp.patch (3.7 KB ) - added by dreammaster 14 years ago.
Patch file for common/unzip.cpp

Download all attachments as: .zip

Change History (4)

by dreammaster, 14 years ago

Attachment: unzip_cpp.patch added

Patch file for common/unzip.cpp

comment:1 by sev-, 14 years ago

Owner: set to sev-
Status: newclosed

comment:2 by sev-, 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 digitall, 6 years ago

Component: --Other--
Note: See TracTickets for help on using tickets.