Skip to content

Optimize class method field fast paths - #4959

Merged
proggeramlug merged 2 commits into
feat/perf-investigate-runtime-comparisonfrom
feat/perf-class-method-direct-dispatch
Jun 11, 2026
Merged

Optimize class method field fast paths#4959
proggeramlug merged 2 commits into
feat/perf-investigate-runtime-comparisonfrom
feat/perf-class-method-direct-dispatch

Conversation

@TheHypnoo

Copy link
Copy Markdown
Member

Summary

  • Add a direct class-method shape guard for statically safe method calls so the hot path avoids typed-feedback site bookkeeping when no instance field can shadow the method.
  • Lower safe PutValueSet class-field writes to the existing direct PropertySet path, including this.field = ... inside class methods.
  • Add typed-feedback-disabled fast contracts for class-field get/set guards to avoid expensive observation/key/descriptor work in normal runs while preserving the full guard when descriptors or prototype fast-guard invalidation are active.

Performance

benchmarks/suite/09_method_calls.ts (--no-auto-optimize, 7 samples):

Runtime Median
Perry 229 ms
Node 11 ms
Bun 20 ms

Previous Perry median on the stacked base was ~6,089 ms, so this is about 26.6x faster for the current bottleneck while preserving the expected output (value:10000000).

Validation

  • rustfmt --check on touched files
  • cargo check -p perry-codegen --quiet
  • cargo test -p perry-runtime typed_feedback --quiet
  • cargo build -p perry --release --quiet
  • Perry/Node output comparison for test-files/test_issue_620.ts

Base automatically changed from feat/perf-array-append-fast-path to feat/perf-investigate-runtime-comparison June 11, 2026 03:15
@proggeramlug
proggeramlug merged commit 18fd310 into feat/perf-investigate-runtime-comparison Jun 11, 2026
1 check passed
@proggeramlug
proggeramlug deleted the feat/perf-class-method-direct-dispatch branch June 11, 2026 03:15
proggeramlug pushed a commit that referenced this pull request Jun 11, 2026
* Optimize numeric array raw payload helpers

* Optimize dense numeric array fill loops (#4958)

* Optimize class method field fast paths (#4959)
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.

2 participants