Repository navigation
perf(transpiler): skip operator retargeting when source has no retargetable construct [W7-01] - #946
ajitpratap0 wants to merge 4 commits into
Conversation
…ntain a retargetable construct [W7-01] scanSource gains an ops flag computed in the existing single byte pass (table-driven); Transpile runs ast.RetargetOperators only when it is set. Output and error text are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @ajitpratap0's task in 37s —— View job Review of PR #946: skip operator retargeting when source has no retargetable constructI read the Verdict: the change looks correct and the prefilter looks safe. I have a few small suggestions below. Correctness
Performance
Maintainability
Tests
No blocking issues. |
Perf gate: PASS (shadow mode: report only, this check never fails)Base Runner CPU:
Rules: each arm runs 20 randomized code layouts ( Gated suite (GOGC=off, GOMAXPROCS=1)
A/A' control (base revision, disjoint layout seeds): 0 of 52 benchmarks moved more than 3%; 0 would have been flagged by the time rule; suite geomean -0.26%, p 0.398. Low power1 benchmark(s) have under 80% estimated power to be flagged on their own for a +5% slowdown (their spread across layouts is too wide for 20 layouts at the Benjamini-Hochberg level alpha/m = 0.000192). A slowdown below the last column usually goes unflagged there; instructions/op, allocs/op and the suite geomean still guard them.
Power is estimated with the normal approximation for the U test (Noether): power = Phi(ln(1+shift)/s * sqrt(K/2) * sqrt(3/pi) - z(1 - alpha/(2m))), with s the spread and K the layouts per arm. Instructions per operation (cmd/perfdriver)
Secondary metric: default GC, GOMAXPROCS=1 (informational)
Environmentbenchstat (primary metric, samples pooled across layouts: informational, the verdict uses the per-layout test) |
…can class [W7-01] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
Claude finished @ajitpratap0's task in 20s —— View job Review of PR #946: skip operator retargeting when source has no retargetable constructI read the Verdict: no blocking issues. The prefilter is conservative in the safe direction. Correctness
Suggestions (non-blocking)
Performance
SecurityNo new input handling. The change only skips a pass whose refusals are keyed on the same bytes. TestsCoverage is strong: the differential test, the required-constructs mutation test, and a |
…perators godoc [W7-01] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
Claude finished @ajitpratap0's task in 22s —— View job Review of PR #946: skip operator retargeting when source has no retargetable constructI read the diff of Verdict: no blocking issues. Correctness
Suggestions (non-blocking)
Performance
SecurityNo new input handling. The change only skips a pass whose refusals are keyed on the same bytes. TestsCoverage is strong: the differential test, the required-constructs mutation test ( |
Summary
Transpileran the reflectiveast.RetargetOperatorswalk on every statement. A newopsflag in the existing single-pass, table-drivenscanSourcerecords whether the source contains any spelling the pass rewrites or refuses (^ | & # ~ @ ? ! { $,<<,>>,->,U&, plus conservative<-,=>,:=). When it is false the walk is skipped. No API, output or error-text change. Differential/equivalence tests (TestPrefilterEquivalence,TestTranspileDifferential, newTestOpsSkipIsSafe,TestOpsPrefilterRequiredConstructs,TestScanSourceOps) enforce it. [W7-01]Test Plan
task check,task test:cbinding,go test ./pkg/compatibility/...,task goldens, staticcheck on changed packages,go vet,gofmt: all pass. (Onetask test:racerun flaked once under heavy machine load; re-run passed.)^ & # ~ @ ? ! {, the|/$ops bits, the<pair, or the-half of->fails at least one test. There is no separateU&scan class:U&is caught by&(the redundant U/u class was removed in 768015e).task bench:ab(layout-randomized gate, 20 layouts, loaded machine, indicative): RW pg_mysql -19.4%, mysql_pg -18.2%, mssql_pg -15.5%, pg_pg +1.2% (p=0.84, ok); allocs/op down 0.2-0.3%, B/op down. Shape small cross pairs -40..-48%, large -27..-29%, medium flat (contains^/||). An earlier byte-switch variant ofscanSourceshowed pg_pg +3.9..+6.6% (significant) so it was replaced by the table-driven loop.Breaking Changes
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2