Preallocate AVM1 constant pool values #2800
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ofgc-arena
GC pressure in some games. For example, in Meat Boy on FF wasm, this change reduced time spent ingc_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 areCopy
. This generates better code, but I'm not sure if you like the less explicit API.