perf(runtime): preserve shared shape index across delete - #9067
Conversation
Clone the validated slot index when delete forks a shared keys array, leaving sibling objects accelerated while retaining the move path for owned sources. Add an end-to-end sibling regression and a dedicated A/B benchmark for PerryTS#9006.
3fd3871 to
0689349
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe runtime preserves shape-index accelerators for sibling objects when a delete compacts a shared keys array. Owned indexes retain move behavior. A regression test and a benchmark validate sibling index preservation and repeated dynamic lookups. ChangesShared delete index preservation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change preserves shared shape indexes during property deletion while keeping owned-array deletions efficient, with regression coverage and passing validation checks. No actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant js_object_delete_field
participant shape_index_migrate_after_delete
participant sibling_Object_hasOwn
js_object_delete_field->>shape_index_migrate_after_delete: pass shared keys-array state
shape_index_migrate_after_delete->>shape_index_migrate_after_delete: clone shared index or move owned index
sibling_Object_hasOwn->>shape_index_migrate_after_delete: perform indexed sibling lookup
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Description checkExplanation The description provides a clear summary, concrete changes, linked issue, performance results, and verification commands. It does not use every template heading or complete the checklist, but it contains the required substantive information. Full details: Docstring CoverageExplanation Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 4 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Merged — this closes #9006, which I filed against #9002, and the fix is exactly the right shape: clone for a shared source, move for an owned one. The asymmetry is the whole point and the comment states it well — forking a shared array is a genuine shape transition (siblings keep naming the old address), while replacing an owned array transfers its identity. Verified end-to-end rather than only at the unit level: 25 same-shape siblings of 60 keys with a delete on one — every untouched sibling keeps all 60 keys and correct values, the deleter has 59 with the right hole; ten siblings each deleting a different key; an owned (non-shared) receiver; and delete-then-re-add on one sibling leaving the other untouched. Byte-identical to node, zero sibling corruption. Worth being precise about what changed, since #9006 was explicitly a throughput issue: correctness was never at risk either way — a stranded sibling rebuilt its index and got the right answer. What this fixes is that it no longer has to. One process note. Your verification ran Validation: the new |
Summary
Performance
On
bench_shared_shape_delete.ts, 15 interleaved A/B pairs pinned to one CPU:Both executables were built from commit-matched compiler/runtime pairs on
perrymaster.skelpo.net.Verification
cargo test -p perry-runtime shared_delete_preserves_the_sibling_shape_index -- --nocapturecargo test --quiet -p perry-runtime -- --test-threads=1(2787 passed, 4 ignored)RUSTFLAGS="-D warnings" cargo check -p perry-runtime --all-targetsscripts/run_lint_gates.shwith compile tier skipped (all 58 runnable lint gates passed; compile covered by the targeted warning-denied check)cargo clippy -p perry-runtime --libCloses #9006.
Summary by CodeRabbit
Bug Fixes
Benchmarks