Skip to content

Conversation

@zml2008
Copy link
Collaborator

@zml2008 zml2008 commented Apr 5, 2022

Zip file instances lock on all reads, so we should try to
load everything we need into memory all at once, rather than
reading multiple times

This does have some negative impact on base memory usage, but reduces allocations from file reads quite a bit, so it's probably about a wash on that front.

These changes knock about 10s off the runtime to decompile 1.18.2 (~40s to ~30s) on my machine (Ryzen 7 3800x, win 11, 64gb ram, SSD), with no change to the output.

Further work on true lazy loading of classes is upcoming, but this was a change with way lower impact, and where my work started so I pulled it out on its own.

Some reports from JFR that led to these changes:

Original

image

image

image

After introducing the ZipFile cache (step 1)

image

image

image

After caching data in the LazyLoader link (step 2)

(yes, this abuses LazyLoader, but LazyLoader is dumb and I don't care)

image

image

image

jpenilla added a commit to PaperMC/patched-spigot-fernflower that referenced this pull request Apr 7, 2022
@zml2008 zml2008 self-assigned this May 28, 2022
Zip file instances lock on all reads, so we should try to
load everything we need into memory all at once, rather than
reading multiple times
@zml2008 zml2008 merged commit 45f51b3 into MinecraftForge:master May 29, 2022
@zml2008 zml2008 deleted the cache-zips branch May 29, 2022 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant