Add benchmark lanes for for-in over arrays, holey-array traversal and large-chunk string concat#2654
Merged
Merged
Conversation
… large-chunk string concat Coverage lanes ahead of a QuickJS-learnings performance campaign: * ForInGuardBenchmark: array receivers for for-in - dense (1,000 ints), holey (every 4th index) and an array carrying extra named own props. for-in over an array currently materializes the full key list (List + JsString per index + numeric sort) on every enumeration; ~1.6-2.5 MB per op on these lanes. * ArrayHoleTraversalBenchmark: index-loop sum, join, indexOf and the in operator over a 75%-holey dense-backed array vs its packed twin. Each hole read leaves the dense fast path and probes the prototype chain; the holey sum lane allocates ~7 MB per op vs 1.4 KB packed. * StringConcatLargeBenchmark: += with 4 KB chunks, 64 KB + 64 KB concatenation and build-then-charAt-scan, versus the small-chunk baseline the current ConcatenatedString already handles well. No engine changes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 13, 2026
This was referenced Jul 15, 2026
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.
Coverage lanes ahead of a performance campaign sourced from studying quickjs-ng internals. No engine changes — these lanes give the upcoming PRs their before/after baselines.
New lanes
for-in: dense (1,000 ints), holey (every 4th index present) and an array carrying extra named own props.for-inover an array currently materializes the full key list (List<JsValue>+ aJsStringper index + numeric sort) on every enumeration — ~1.6–2.5 MB allocated per op on these lanes.join,indexOfand theinoperator over a 75%-holey (still dense-backed) array vs its packed twin. Each hole read leaves the dense fast path and probes the prototype chain: the holey sum lane allocates ~7 MB per op vs 1.4 KB for the packed twin.+=with 4 KB chunks, 64 KB + 64 KB concatenation, and build-then-charCodeAt-scan, next to the small-chunk baseline that the currentConcatenatedStringalready handles well. Input for a GO/NO-GO on a rope-style representation for large pieces.Campaign context
A study of quickjs-ng confirmed most of its playbook is already in place here (shapes, per-node inline caches — which quickjs-ng notably removed again for lack of a JIT to consume type feedback — slot-resolved locals, int arithmetic lanes, sliced/concatenated strings, lazy built-ins). The confirmed gaps these lanes cover:
for-inover arrays — QuickJS enumerates0..count-1lazily with no key array (build_for_in_iteratorfast path).HasPropertyprobes — QuickJS guards its whole array fast path with a single "clean array prototypes" invariant flag (std_array_prototype).Follow-up PRs will address these one at a time, each gated on these lanes.
🤖 Generated with Claude Code