Repository navigation
perf(rust): 16-byte property entries, with room for exactly what an object is made with - #87
Merged
Merged
Conversation
hearnadam
force-pushed
the
perf/stack-04-props
branch
from
November 26, 2026 17:20
558a388 to
357debe
Compare
kommander
force-pushed
the
perf/stack-04-props
branch
from
November 26, 2026 22:45
357debe to
f504a81
Compare
…bject is made with A property held its value as a 16-byte Value in a 24-byte entry, and a property list started with room for four. Prop holds its value as a Slot, as the stack does (16 bytes), behind value() and set_value(); most of this diff is those two at its call sites. An object literal reserves exactly the properties it names (Op::NewObject(n)), a spread its source's count, any other list starts at two entries, and JSON.parse at four. Waiting run, bytes per 4-property object: 203 to 171; per 2-field class instance: 198 to 136. Cost: class construction about 6% more instructions, one more reallocation an instance.
kommander
force-pushed
the
perf/stack-04-props
branch
from
November 26, 2026 22:49
f504a81 to
c5ce282
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A property held its value as a 16-byte Value in a 24-byte entry, and a property
list started with room for four. Prop holds its value as a Slot, as the stack
does (16 bytes), behind value() and set_value(); most of this diff is those two
at its call sites. An object literal reserves exactly the properties it names
(Op::NewObject(n)), a spread its source's count, any other list starts at two
entries, and JSON.parse at four.
Waiting run, bytes per 4-property object: 203 to 171; per 2-field class
instance: 198 to 136.
Cost: class construction about 6% more instructions, one more reallocation an
instance.
Part 4 of 11 in a stack; based on
perf/stack-03-heap-chunks. Each part was built, linted and tested on its own (cargo test --release --workspace, the same underPSYCHOSCRIPT_GC_STRESS=1, and the conformance cases underPSYCHOSCRIPT_ROUNDTRIP=1). Numbers are instructions retired, fromrust/bench/examples/corpusandmem_probe(part 1).