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

core: Various memory optimizations #18773

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

adrian17
Copy link
Collaborator

@adrian17 adrian17 commented Nov 26, 2024

Draft, as I still want to test it a bit more.

This makes us no longer copy compressed image data from SWFs to vecs.
The most extreme cases (100+MB SWFs like mardek, EBF), this can save up to 12-15MB of memory (we have like 600MB of RAM use by the time preloader finishes in Mardek: Nineveh mod). For average SWFs this is probably closer to <1MB.
Any loading speedup is insignificant compared to time spent in DefineShape.

OwnedJpeg is needed because of optionally appending jpeg_tables in DefineBits; I could move them to become lazy too (and this way everything could be SwfSlice), but this'd mean we repeat this work each time we loadBitmap() or SymbolClass-construct a BitmapData; it's a rare combo, but I'd rather not risk sometimes doing duplicate work until a possible refactor to deduplicate the entire image decoding work.

EDIT: added a similar improvement for Sounds; should have between 30-80% of most SWFs' size. Best I've seen was 50-80MB, but for most SWFs it'll be closer to 1-2MB or less.

@adrian17 adrian17 added T-perf Type: Performance Improvements A-core Area: Core player, where no other category fits labels Nov 26, 2024
@adrian17 adrian17 force-pushed the dont-copy-compressed-data branch from 9c31543 to 71c8be3 Compare November 27, 2024 20:36
@adrian17 adrian17 changed the title core: Store CompressedData as SwfSlice instead of copied vecs core: Various memory optimizations Nov 27, 2024
@adrian17 adrian17 force-pushed the dont-copy-compressed-data branch from 71c8be3 to ef0946a Compare November 27, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core player, where no other category fits T-perf Type: Performance Improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant