Skip to content

Conversation

@dengr1065
Copy link
Collaborator

Alternative to #71 - does almost the same in a slightly different way. This PR once again adds a separate class for built-in compression implementation (gzipped MessagePack) and makes use of it in the Storage implementation. Unlike upstream, this compression is applied on a lower level, so all files are compressed instead of just RWProxy and other explicit usages. There needs to be a way to bypass this, and that's exactly why the Storage constructor optionally accepts a different storage interface. This may be useful for mods once they get own data directories.

Unlike #71 this implementation creates a new worker for each operation, which may help with intensive compression operations; workers are terminated after use. Error handling for workers may be simplified once Error.isError becomes available in Electron.

To be simplified and replaced with renderer-side web workers.
Remove a temporary console.log statement as well as now-unused msgpack
module.
Does not fix the savegame list bugs. Note that savegame index
serialization happens a few times for some reason, this is out of scope
for this commit though.
Implement DefaultCompression class along with a generic interface to
facilitate easy to use compression in a background thread, and make use
of this class in Storage implementation by default.
While the browser engine can clean up workers automatically, it's a good
idea to terminate them as soon as we don't need those anymore. It's
generally suggested to reuse a single worker for repetitive operations,
but implementing such a system is much harder. In addition, spawning a
new worker for each operation allows (de)compressing multiple blobs in
parallel :)
@dengr1065 dengr1065 merged commit 7cb3477 into master Jun 12, 2025
1 check passed
@dengr1065 dengr1065 deleted the dengr1065/new-compression-attempt2 branch June 14, 2025 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants