Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zip archive always loaded into RAM #2400

Open
paroj opened this issue Mar 9, 2022 · 3 comments
Open

zip archive always loaded into RAM #2400

paroj opened this issue Mar 9, 2022 · 3 comments

Comments

@paroj
Copy link
Member

paroj commented Mar 9, 2022

currently, we load the complete zip archive into RAM when opening:

mBuffer.reset(new MemoryDataStream(_openFileStream(mName, std::ios::binary)));

this increases the loading time, if the majority of the contents are not read.

this is a zip API limitation, which only allows passing buffers when externally opening the file.
The underlying miniz API actually allows passing read callbacks:
https://github.com/richgel999/miniz/blob/5a38f5564a092462817b97014f4477c8f0783f8f/miniz_zip.h#L173-L175

using these would allow seeking in the file, which improves loading time in the above scenario.

@tritonas00
Copy link
Contributor

Is this the reason we experience slower cache generation in RoR with Ogre 13 also?

@paroj
Copy link
Member Author

paroj commented Oct 6, 2022

probably. Although generation should not be noticeable slower. update should be - i.e. if you only want to read some file metadata without reading the whole file.
Maybe you triggering some bad behavior where a zip file is loaded twice? Previously, you would only pay on reading, but now you pay regardless.

@tritonas00
Copy link
Contributor

eh dont really know, here we parse https://github.com/tritonas00/rigs-of-rods/blob/12d8ece21d0453f66803e356fd2cebe6943e1875/source/main/resources/CacheSystem.cpp#L997

i remember though if we dont unload at the end, we had massive ram usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants