Skip to content

perf(codegen): specialize call-returned array stores - #8820

Closed
proggeramlug wants to merge 2 commits into
mainfrom
perf/call-return-array-index
Closed

perf(codegen): specialize call-returned array stores#8820
proggeramlug wants to merge 2 commits into
mainfrom
perf/call-return-array-index

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

What changed

  • recognize the structurally identical PutValueSet.target and .receiver HIR trees as the single source evaluation they represent, including a call expression such as this.getData()[index] = value
  • retain the statically known Array type and lower that store through the existing typed-feedback array-index helper instead of the generic Proxy-compatible dynamic PutValue IC
  • keep genuinely different receiver trees fail-closed on the explicit-receiver path
  • complete the shared strict array-index guard for own non-writable/getter-only descriptors, setter accessors, read-only length extension, and holes on non-extensible arrays
  • add focused generated-IR tests plus an executable semantics regression covering evaluation count, fractional keys, assignment result, Proxy traps, descriptors, non-extensible holes, and read-only length

This is a general lowering/runtime fix: it contains no ECS names, benchmark labels, workload thresholds, or command-buffer special cases. IndexSet::lower still evaluates the assignment base once; the structural check only recovers the identity already encoded by HIR.

Verification

  • cargo fmt --all -- --check
  • git diff --check
  • python3 scripts/gc_store_site_inventory.py --gate (1,579 files; all 97 runtime barrier claims source-verified)
  • focused codegen IR tests: 2 passed
  • executable compiler/runtime semantics test: 1 passed
  • full serial debug runtime suite on the rebased commit: 2,689 passed, 0 failed, 4 ignored
  • full serial release runtime suite on the Mac mini from SHA-matched rebased sources: 2,689 passed, 0 failed, 4 ignored

One initial local executable-test compile reported successful module codegen but lost its temporary main_ts.o before the clang link. The exact isolated retry passed in 13.3 seconds; the semantic assertions did not fail.

Mac mini benchmark evidence

Five interleaved Perry/Perry A/B pairs used the same precompiled isolated ECS 15k-command source, with this change stacked on #8807 and #8813. Each process used 2 warmups and 6 measured rounds; all 10 process-level semantic oracles passed.

  • control median: 58.392 ms
  • candidate median: 50.866 ms
  • median paired improvement: 12.889%
  • paired range: 12.672% to 13.318%
  • candidate wins: 5/5

The candidate Archetype IR contains three calls to js_typed_feedback_array_set_index_or_string and no calls to js_put_value_set_dyn_ic. Binary SHA-256 values were pinned for both arms. This is an admitted mechanism gain, not a Node-parity claim; the wider ECS plan continues to track the remaining gap separately.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 2 minutes.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d227c361-0202-48cc-a6b4-f67f8930de1e

📥 Commits

Reviewing files that changed from the base of the PR and between 8f026e5 and f7000a2.

📒 Files selected for processing (6)
  • changelog.d/8820-call-return-array-stores.md
  • crates/perry-codegen/src/expr/call_return_array_index_tests.rs
  • crates/perry-codegen/src/expr/mod.rs
  • crates/perry-codegen/src/expr/proxy_reflect.rs
  • crates/perry-runtime/src/array/indexing.rs
  • crates/perry/tests/call_return_array_index.rs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

proggeramlug added a commit that referenced this pull request Aug 25, 2026
* fix(async_hooks): address lifecycle review feedback

* fix(doctor): reject stale runtime archives

* docs: add runtime compatibility changelog fragment

* fix(sharp): support create input descriptors

* perf(codegen): specialize call-returned array stores

* perf(map): repair ordered-delete indexes in place

* chore: add changelog for map delete optimization

* test(map): root ordered-delete string keys

* feat(qs): add native Stripe-compatible shim (#8751)

* docs: add changelog fragment for sharp create

* fix(runtime): complete build identity inputs

* test(compile): cover compiled package builtin imports

* chore: add changelog for array-store optimization

---------

Co-authored-by: Ralph Küpper <ralph@skelpo.com>
@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed on main via the #8822 batch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant