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

Preallocate AVM1 constant pool values #2800

Merged
merged 2 commits into from
Jan 23, 2021

Conversation

adrian17
Copy link
Collaborator

@adrian17 adrian17 commented Jan 23, 2021

AFAIK this change shouldn't change any observable behaviors?

This seems reasonable in general (now these objects are actually pooled, and removes a bunch of work from action_push), and is another step towards pre-hashing constant strings like property names in the future.

What positively surprised me, is that apparently AvmString::new called on nearly every ActionPush was a major source of gc-arena GC pressure in some games. For example, in Meat Boy on FF wasm, this change reduced time spent in gc_arena.collect_debt() by 2-3x and - on my PC - improved the game from "slightly choppy most of the time" to "smooth most of the time" :)

Second commit makes avm1::Value Copy, as all its fields are Copy. This generates better code, but I'm not sure if you like the less explicit API.

@adrian17 adrian17 force-pushed the preallocate-constant-pool-values branch 4 times, most recently from 93e4cb8 to 425e889 Compare January 23, 2021 18:16
@adrian17 adrian17 force-pushed the preallocate-constant-pool-values branch from 425e889 to 5770b19 Compare January 23, 2021 18:29
@Herschel
Copy link
Member

Thanks! I agree with changing Value to Copy, there's no good reason not to.

@Herschel Herschel merged commit 0a64c34 into ruffle-rs:master Jan 23, 2021
@adrian17 adrian17 mentioned this pull request Jan 27, 2021
@adrian17 adrian17 deleted the preallocate-constant-pool-values branch March 12, 2021 23:49
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