Skip to content

perf: extend _line_gates beyond c/cpp/go state_mutation (ts/java narrowing audit + 9 already-eligible languages) #3171

Closed

Description

@squid-protocol

Follow-up to #3072 / PR #3170. The machinery is done; this is scope extension only, and pattern_is_line_local + derive_line_literals make the audit mechanical.

Eligibility sweep over every language's state_mutation (run on the #3170 branch):

Eligible today but unshipped (9): ada, haskell, lua, m4, makefile, scheme, tcl, yacc, zig. These build a gate right now; each just needs the line_gate_bench.py acceptance run (corpus win + ≤35% dense loss) before adding its _line_gates entry — #3072's lesson is that cheap patterns lose (python decorators went 23→49ms), so ship only measured winners. Most of these corpora are small; expect several to fail the corpus-win bar, which is fine.

Refused as "not line-local" and worth a narrowing audit (the cpp playbook): typescript, java, javascript, python, rust, csharp, kotlin, swift, scala, dart, php, ruby, objective-c, groovy, apex, solidity, perl, shell, matlab, cobol, abap, and friends (35 total). cpp was in this bucket until #3170 narrowed its method-call arms \s*\( → [ \t]*\( with zero match movement across the whole corpus. The high-value targets are the big-corpus languages: typescript, java, javascript, python, rust. For each: find which node(s) pattern_is_line_local rejects, decide whether the \s/newline-spanning shape is load-bearing (a genuine multi-line form) or incidental (paren/operand binding that never really spans), narrow only the incidental ones, prove zero corpus movement (crucible + rosetta), golden-check, then opt in.

Refused as "no literal set" (8): agc_assembly, assembly, dockerfile, fortran, hlasm, jcl, powershell, rexx — their state_mutation bottoms out with no derivable required literal; nothing to do without rule redesign.

Bar (same as #3072): exact-parity leg in gate_parity_audit.py must stay at zero violations; every new entry must pass line_gate_bench.py; any pattern narrowing needs a corpus zero-movement proof and golden crucible both legs.

Not in scope: func_start/match_at gating (proven unwinnable, measurements recorded on #3072) and the #3073 combined-alternation scan (separately deferred).

🤖 Generated with Claude Code

Activity

  1. squid-protocol commented on Sep 18, 2026

    @squid-protocol
    OwnerAuthor

    Expectations note so nobody picks this up hoping for a big win: every item here is sub-1% end-to-end, likely much less. The arithmetic from #3072/#3170: state_mutation is ~7–8% of the rule pass, a line gate recovers ~⅔ of it, and the rule pass is ≤ half of wall time — that capped even c+cpp+go combined at ~1% on node. The nine eligible-today languages are small-corpus and round to ~0% in mixed-repo scans; the ts/java/js/python narrowing audits are the only entries that could touch ~1%, and each carries a pattern-change proof burden. Treat this as opportunistic background chores (e.g. while touching a language file anyway), not a dedicated perf push. The next dedicated push should start from fresh phase-level profiling, not from this lever.

    🤖 Generated with Claude Code

  2. added
    core-engine
    priority: low
    on Sep 18, 2026
  3. squid-protocol commented on Sep 18, 2026

    @squid-protocol
    OwnerAuthor

    Machinery is ready for this — no new engine primitives needed:

    • Eligibility is machine-checked by pattern_is_line_local, and build_line_gate uses _pick_most_selective, so the ts/java state_mutation narrowing is a mechanical audit: add the rule to _line_gates, and if build_line_gate refuses or line_gate_bench.py shows a corpus loss / >35% dense loss, drop it.
    • #3173 added a prefer_selective flag to derive_literal_gate (same picker) for the security signatures — worth a glance for consistency, though it's the segment gate, not the line gate.
    • A/B the survivor-rate + wall with tests/tools/phase_ab.py (tooling(perf): reusable phase A/B harness + perf-ab skill #3178) plus the existing line_gate_bench.py acceptance leg.

    Still correctly filed low-priority / background.

  4. squid-protocol commented on Sep 19, 2026

    @squid-protocol
    OwnerAuthor

    Fleet payoff: small as scoped — but the machinery points at a much bigger target

    Fleet-wide (739 repos), state_mutation is a minor rule: c::state_mutation 44s, cpp 43s, and the ts/java/js/rust/python variants smaller still — a rounding error against B_Braces at 3,931s (53% of all rule CPU). So line-gating state_mutation across the 9 eligible languages is a genuine-but-marginal win; worth shipping the measured winners opportunistically, not a priority.

    The more valuable insight is that _line_gates / pattern_is_line_local is exactly the lever the hot rules need. The real prize is applying the same line-locality narrowing to B_Braces and func_start (55% of rule CPU between the Cartography modes and func_start), especially for the C-family. That's a bigger, separate audit than this state_mutation scope-extension — flagging it here so the connection isn't lost; it likely belongs under #3182.

    Recommendation: keep priority: low for the state_mutation extension; pursue the hot-rule line-gating under #3182.

  5. added
    scope:infra
    on Oct 16, 2026
  6. added
    needs:corpus
    needs:crucible
    on Oct 18, 2026
  7. squid-protocol commented on Oct 24, 2026

    @squid-protocol
    OwnerAuthor

    Churn run 3171-20261024T0921Z (host melek) ended without a PR. Slice 5 of #3171 already done on main (#5439, #6398 benched all nine); no PR. Remaining php/ruby narrowing audits are low priority.

  8. squid-protocol commented on Oct 24, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host nyx, lease renewed 2026-10-24T09:32Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:nyx label.

  9. squid-protocol commented on Oct 24, 2026

    @squid-protocol
    OwnerAuthor

    Closing: every eligible candidate is shipped or benched and refused (ada, yacc, ts/js/python, csharp, groovy shipped; rust, haskell, lua, m4, makefile, scheme, tcl, zig, java, kotlin, swift measured and refused, PRs #5439 #6368 #6407 #6391 #6398 #6444). The remaining languages are not line-local, are unaudited and likely fail the dense bar; reopen or file a fresh issue if one is needed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    claim:nyxcore-engineneeds:corpusneeds:crucibleperformancepriority: lowscope:infra

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions