Skip to content

perf(javascript): skip the repeated-prefix scan on first capture visits - #1789

Merged
morluto merged 1 commit into
morluto:mainfrom
flitzrrr:fix/javascript-alias-prefix-scan
Oct 11, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
flitzrrr:fix/javascript-alias-prefix-scan

Conversation

@flitzrrr

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1767. That PR was merged before this commit, which answers the
review comment on the suffix scan, reached the branch.

collectSemanticMemberMutationsSteps searched every suffix of the current path
for an earlier visit, even on a binding's first visit at a capture, where no
earlier visit can exist. The scan now runs only when the capture is already on
the alias chain.

Problem and expected behavior

For a deep write through many aliases with no projection
(const a1 = a0; …; aB.p1…pL = 1), each alias is a first visit. The scan still
sliced and serialized all L suffixes per alias, which is Θ(L²) per alias.
Expected: a first visit does no suffix work.

Change and scope

Add a capture key to the alias chain's lifetime set and skip the scan when the
capture is absent. Behavior is unchanged: a suffix can only match an earlier
visit of the same capture.

Not included: the finite path expansion that dominates long self-alias chains
(see the measurements in #1767). It predates #1767 and needs its own fix.

Contract and boundary impact

  • Semantic owner and earliest changed stage: domain JavaScript member-mutation collection.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none; identical results.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated: none. The change removes work without changing
    results, and the existing self-alias and lifetime cases cover the scan's
    outcomes.
  • Base reproduction or other evidence: 300 aliases × path depth 300, on macOS
    with Node 24.18.0: 1.75 s on origin/main and 1.73 s with this change. The
    scan is not the dominant cost at this size; the change removes its
    quadratic term.
  • User-visible CLI/MCP output (if applicable): none.
  • Remaining proof gaps: no benchmark covers sizes where the scan would dominate.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npx vitest run src/domain/javascript/ — 43 files, 821 passed
  • npm run check:fast — passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; macOS only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: removes avoidable work on untrusted input.

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code

Review follow-up. Only a capture already on the alias chain can repeat a prefix, so a first visit no longer slices and serializes every suffix of its path.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T10:01:48.742855Z dd12543 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@morluto
morluto merged commit 41544fb into morluto:main Oct 11, 2026
28 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 11, 2026
3 tasks done
@morluto

morluto commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Thanks for following up on #1767’s review point, @flitzrrr. The capture-key guard avoids building and serializing path suffixes on first visits, where no repeat can exist. I also appreciate the benchmark note: it records the removed work without claiming an end-to-end speedup at that input size.

@morluto morluto added performance Performance regressions, scaling limits, and bounded-resource work area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added the area: runtime Process capture and runtime observation label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: runtime Process capture and runtime observation performance Performance regressions, scaling limits, and bounded-resource work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants