[PR #1520] [CLOSED] perf(javascript): index returned method analysis #2939

Closed
opened 2026-10-17 21:12:02 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1520
Author: @geekwolf
Created: 10/10/2026
Status: ❌ Closed

Base: main ← Head: fix/js-returned-reference-scaling


📝 Commits (5)

  • 4916c5b perf(javascript): index returned object methods
  • 5d26c5e perf(javascript): reuse receiver effects
  • fe39f3d test(javascript): cover returned method scaling
  • 41a3d77 fix(javascript): retain receiver effect semantics
  • e86583b test(javascript): remove timing threshold

📊 Changes

3 files changed (+205 additions, -14 deletions)

View changed files

📝 src/domain/javascript/javascriptSemanticAnalysis.member_mutations.test.ts (+51 -0)
📝 src/domain/javascript/javascriptSemanticMemberMutations.ts (+74 -13)
📝 src/domain/javascript/javascriptSemanticReturnedReferences.ts (+80 -1)

📄 Description

Summary

Fixes #1495.

Avoid quadratic semantic analysis when many object methods return the same reference.

Problem and expected behavior

Resolving each box.mN() call rescanned the complete object literal, and receiver escape handling repeated the same whole-object effect for every call. A 2,000-method reproduction took about 5.6 seconds locally.

Change and scope

  • index static object properties once while preserving duplicate-property, computed-property, and spread semantics
  • reuse receiver escape effects only when the binding and its selected initializer lifetime are identical
  • add the reported 2,000-method regression shape with its semantic assertion

Contract and boundary impact

  • Semantic owner and earliest changed stage: JavaScript semantic member-mutation analysis
  • CLI and MCP/tool-catalog contract: none
  • Provider, bridge, target-format, or platform compatibility: none
  • Evidence, artifact, provenance, or reconstruction contract: preserves existing mutation uncertainty
  • Process execution, authorization, cleanup, or containment impact: none
  • Generated metadata, package, or installation impact: none

Evidence and regression coverage

  • Tests added or updated: returned-object method scaling regression
  • Base reproduction: approximately 5.6 seconds for 2,000 methods/calls on this Windows host
  • Fixed reproduction: approximately 0.3 seconds
  • Remaining proof gaps: not benchmarked on Linux or macOS

Validation performed

  • npx vitest run src/domain/javascript/javascriptSemanticAnalysis.member_mutations.test.ts — 154 passed
  • npx vitest run --project acceptance tests/acceptance/applications/javascriptReturnedReferences.test.ts — passed
  • npm run check:fast — passed
  • npm run build:cached — passed

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1520 **Author:** [@geekwolf](https://github.com/geekwolf) **Created:** 10/10/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/js-returned-reference-scaling` --- ### 📝 Commits (5) - [`4916c5b`](https://github.com/morluto/rea/commit/4916c5bc78ea51444cd8697b7237e54431626dd5) perf(javascript): index returned object methods - [`5d26c5e`](https://github.com/morluto/rea/commit/5d26c5ee61a43e02a337fd553dae9ec7b5d2d589) perf(javascript): reuse receiver effects - [`fe39f3d`](https://github.com/morluto/rea/commit/fe39f3dda3425ffe9d1383e26bacc185e619c272) test(javascript): cover returned method scaling - [`41a3d77`](https://github.com/morluto/rea/commit/41a3d7719aeaad55a23f5f1eb92c1877505a7c0d) fix(javascript): retain receiver effect semantics - [`e86583b`](https://github.com/morluto/rea/commit/e86583ba8f86f883437ee6c55ba09371d260d15a) test(javascript): remove timing threshold ### 📊 Changes **3 files changed** (+205 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/javascriptSemanticAnalysis.member_mutations.test.ts` (+51 -0) 📝 `src/domain/javascript/javascriptSemanticMemberMutations.ts` (+74 -13) 📝 `src/domain/javascript/javascriptSemanticReturnedReferences.ts` (+80 -1) </details> ### 📄 Description ## Summary Fixes #1495. Avoid quadratic semantic analysis when many object methods return the same reference. ## Problem and expected behavior Resolving each `box.mN()` call rescanned the complete object literal, and receiver escape handling repeated the same whole-object effect for every call. A 2,000-method reproduction took about 5.6 seconds locally. ## Change and scope - index static object properties once while preserving duplicate-property, computed-property, and spread semantics - reuse receiver escape effects only when the binding and its selected initializer lifetime are identical - add the reported 2,000-method regression shape with its semantic assertion ## Contract and boundary impact - Semantic owner and earliest changed stage: JavaScript semantic member-mutation analysis - CLI and MCP/tool-catalog contract: none - Provider, bridge, target-format, or platform compatibility: none - Evidence, artifact, provenance, or reconstruction contract: preserves existing mutation uncertainty - Process execution, authorization, cleanup, or containment impact: none - Generated metadata, package, or installation impact: none ## Evidence and regression coverage - Tests added or updated: returned-object method scaling regression - Base reproduction: approximately 5.6 seconds for 2,000 methods/calls on this Windows host - Fixed reproduction: approximately 0.3 seconds - Remaining proof gaps: not benchmarked on Linux or macOS ## Validation performed - `npx vitest run src/domain/javascript/javascriptSemanticAnalysis.member_mutations.test.ts` — 154 passed - `npx vitest run --project acceptance tests/acceptance/applications/javascriptReturnedReferences.test.ts` — passed - `npm run check:fast` — passed - `npm run build:cached` — passed --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:12:02 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2939
No description provided.