Repository navigation
perf(rust): BigInt in the value word under 31 bits, in its heap slot up to 128 - #90
Merged
Merged
Conversation
hearnadam
force-pushed
the
perf/stack-07-bigint
branch
from
November 26, 2026 17:20
4a78136 to
ae7c629
Compare
kommander
force-pushed
the
perf/stack-07-bigint
branch
4 times, most recently
from
November 26, 2026 22:52
cc33123 to
375fdbf
Compare
…up to 128 Every BigInt result was a heap slot, a box, a digit vector and a hash. Under 31 bits it is now in the id of its Value::Big, with no object; up to 128 bits it is in place in one heap slot, with machine arithmetic; larger, the slot holds a boxed num_bigint as before. Each value has exactly one form, so equality and Map keys still compare ids. JavaScriptCore has only the heap form (its inline BigInt32 was never enabled, and was removed in 2026). 64-bit FNV hash, 100k rounds: 640M to 409M instructions, 44.6 to about 17 ms. Checked against Bun on 8,385 results across the 31-, 64- and 128-bit boundaries.
kommander
force-pushed
the
perf/stack-07-bigint
branch
from
November 26, 2026 22:54
375fdbf to
be65e21
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.
Every BigInt result was a heap slot, a box, a digit vector and a hash. Under 31
bits it is now in the id of its Value::Big, with no object; up to 128 bits it
is in place in one heap slot, with machine arithmetic; larger, the slot holds a
boxed num_bigint as before. Each value has exactly one form, so equality and
Map keys still compare ids. JavaScriptCore has only the heap form (its inline
BigInt32 was never enabled, and was removed in 2026).
64-bit FNV hash, 100k rounds: 640M to 409M instructions, 44.6 to about 17 ms.
Checked against Bun on 8,385 results across the 31-, 64- and 128-bit
boundaries.
Part 7 of 11 in a stack; based on
perf/stack-06-gc-while-waiting. 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).