perf: specialize guarded ECS typed columns - #8845
Closed
proggeramlug wants to merge 1 commit 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 26, 2026
* docs: design Node-API host * perf: reuse guarded ECS entity indices * fix(runtime): reject oversized generic slice results * perf: specialize guarded ECS typed columns * chore: batch-landing fixes (per-arm GC store markers, index_set packed-loop split) --------- Co-authored-by: Ralph Kuepper <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
Uint32ArraysINT32Number representationThis is stacked on #8839. Once #8839 lands, this PR can be retargeted to
mainwithout changing its diff.Why
After #8839, the Wolf ECS hot loop still paid erased TypedArray receiver/kind/data/length dispatch for every component access. The generated system kernel dominated the profile. Runtime admission can establish the stronger representation and alias facts once, allowing the loop itself to operate on raw Uint32 lanes.
The final AArch64 inner loop is reduced to one compact entity-id load, one component bound check, two component loads, two stores, and integer induction/control.
Performance
Pinned Mac mini, unchanged
noctjs/wolf-ecs/simple_iteroracle, precompiled full-runtime binaries (--no-auto-optimize),taskpolicy -t 0 -l 0:Cleanup A/B against the retained v10 mechanism artifact was neutral, as expected: 0.005281 vs 0.005276 ms/op (-0.10%, noise), 16/16 semantic oracles, identical 207,847,424-byte max RSS. The fresh Node cohort passed 8/8 semantic oracles.
The quick cohorts intentionally used a one-sample idle gate and are development evidence, not a strict publication-quality run. JSON artifacts and binaries were retained locally under
/private/tmp/perry-ecs-artifacts-8772.Validation
cargo fmt --allgit diff --checkcargo check --release -p perry-codegen -p perry-runtimecargo test --release -p perry-runtime --lib array::subclass_tests -- --nocapture(10/10)Follow-up
The remaining measured gap is only ~3%. The next useful optimization is backend-level control-flow amortization: emit the already-matched swap kernel directly (or attach loop-specific LLVM unroll metadata) so it can be unrolled/software-pipelined without lowering the HIR body twice. A manual HIR-body duplication experiment was rejected because it perturbed compiler fact state outside the kernel; no part of that experiment is included here.