perf(map): specialize declared Map.get dispatch - #8830
Closed
proggeramlug wants to merge 2 commits into
Closed
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
proggeramlug
added a commit
that referenced
this pull request
Aug 25, 2026
* perf(codegen): specialize branded ReadonlySet.has * chore: add changelog for #8826 * chore(codegen): classify readonly Set type hint * fix(async_hooks): address lifecycle review feedback * refactor(async_hooks): split resource scopes * fix(net): account only accepted socket writes * fix(async_hooks): use scoped runtime handles * chore(changelog): key async hooks fragment to PR * fix(async_hooks): preserve scoped event coercion * refactor(events): split scoped emit thunks * test(async_hooks): classify forced GC trigger * perf(map): specialize declared Map get dispatch * chore: add changelog for #8830 * runtime(gc): resolve x19 frame-base roots in the fast fp-chain walk (#8770) LLVM takes x19 as a frame base pointer for a function with a dynamic stack allocation (a VLA or a spread-argument area). Its GC roots are stack slots addressed via x19, and x19 is established as `mov x19, sp` immediately after the fixed prologue and before the dynamic `sub sp, sp, xN`, with no realignment — so x19 holds exactly the body SP the fp chain already reconstructs (`fp - fp_to_sp_offset`). Before this, any x19 root flipped the whole-image `chain_walkable` flag false (it required EVERY root to be fp/sp), which globally disabled the fast x29-chain root walk and forced every GC onto the platform unwinder. In cli.js just 63 of 72,812 functions use an x19 base, yet they disabled the correct fast walker for all of them; the unwinder then mis-resolved compiled-JS stack-slot roots and live young objects were swept (0xff-poison-receiver SIGSEGV / `(number).get is not a function`). Make `chain_walkable` accept x19 and resolve an x19 root like an SP root, gated per frame by `x19_is_body_sp` (confirms the `mov x19, sp` prologue shape); a frame that does not match still fails closed to the unwinder. Any other base register still disables the chain walk. Claude-Session: https://claude.ai/code/session_01TwxRkALrR9HKSF1zKLSTAF * chore: runtime-validated verdict for is_declared_map_expr (#8830) --------- Co-authored-by: Ralph Küpper <ralph@skelpo.com>
Contributor
Author
|
Landed on |
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.
Summary
Why
A steady-state profile of the unchanged codehz/ecs 15k-command workload placed 1,015 samples in generic native method dispatch for this.ctx.entityToArchetype.get(entityId). The nested interface-typed field retained its Map declaration, but not the stronger native-layout proof used by the existing direct lowering.
This change uses the declaration only to select a guarded runtime operation. A receiver whose tracked GC type is exactly the built-in Map kind enters the existing generic Map key lookup directly. Every brand miss roots both operands and uses the ordinary method dispatcher. It does not add numeric-key classification or change Map layout, lookup semantics, or the existing proven-native path.
Correctness
The upstream ECS functional sweep passed 461/463 cases. Both failures reproduced identically on the exact parent binary. The candidate introduced no new performance-threshold failure: serialization and sparse-wildcard fail their existing upstream ceilings on both candidate and exact parent.
Performance
M1 Mac mini, unchanged codehz/ecs v0.13.0 at 58d729682eeb88d7361796de0420f3d673e27479, 15k-command comprehensive row, exact rebased #8826 control, two warmups and six measured rounds per process:
A same-host Node 26.5.1 comparison measured 2.905 ms versus Perry at 31.828 ms, so this is an admitted incremental fix, not ECS command-path parity.
Stacked on #8826 for an isolated review diff.