Repository navigation
perf(linter): release AST and recycle tokens after Check for all rule sets [W6-06cd] - #962
Conversation
…le set [W6-06cd] 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. 1 Skipped Deployment
|
|
Claude finished @ajitpratap0's task in 27s —— View job Review of PR #962I read the diff and traced the lifetime ordering in Verdict: looks good, with a few minor suggestions. Correctness
Risks
Tests
Performance
Nits
No blocking issues. Please resolve the |
#961 replaced direct CHANGELOG.md edits with per-PR changelog.d/ fragments, which removes this PR's CHANGELOG.md merge conflicts. The entry text is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
Claude finished @ajitpratap0's task in 18s —— View job Review of PR #962I read the diff and checked Verdict: looks good. I found nothing blocking. Checked
Suggestions (non-blocking)
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
Claude finished @ajitpratap0's task in 16s —— View job Review of PR #962I read the full diff, including the Verdict: no blocking issues. The only open item is the perf-gate result. Correctness
Suggestions (non-blocking)
TestsCoverage is strong:
|
Perf gate: PASS (shadow mode: report only, this check never fails)Base Runner CPU:
Rules: each arm runs 20 randomized code layouts ( Stage 1 used 20 layouts per arm; 62 benchmark(s) received planned adaptive extensions, with 4 warm-up benchmark(s) and 0 unclassified benchmark(s), to up to 78 layouts per arm. Only primary time uses those extra layouts; every other rule uses stage-1 data. Gated suite (GOGC=off, GOMAXPROCS=1)
A/A' control (base revision, disjoint layout seeds): 2 of 71 benchmarks moved more than 3%; 0 would have been flagged by the time rule; suite geomean -0.36%, p 0.149. Low powerAdaptive layouts: 62 benchmark(s) extended from 20 to up to 78 layouts per arm (budget); 4 warm-up benchmark(s), 0 unclassified benchmark(s) received extra measurements. 3 benchmark(s) have under 80% estimated power to be flagged on their own for a +5% slowdown at the Benjamini-Hochberg level alpha/m = 0.000141. Instructions/op, allocs/op and the stage-1 suite geomean still guard them.
Power is estimated by Noether's normal approximation using the empirical AUC of pooled within-arm log residuals, excluding self-pairs and giving half credit for ties. 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) |
…nce changelog fragment [W6-06cd] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
Claude finished @ajitpratap0's task in 24s —— View job Review of PR #962I read the diff for Verdict: no blocking issues. Correctness
PerformanceThe perf gate passed, and the target was met.
Suggestions (non-blocking)
TestsCoverage is good:
The fix to |
|
Claude finished @ajitpratap0's task in 17s —— View job Review of PR #962 (latest sync)I read the diff for Verdict: no blocking issues. Correctness
PerformanceThe gate passed and the target was met.
Suggestions (non-blocking)
TestsCoverage is good:
|
…ease-ast # Conflicts: # pkg/linter/linter.go
…nto perf/w6-06cd-lint-release-ast
|
Claude finished @ajitpratap0's task in 17s —— View job Review of PR #962 (latest sync)I read the diff for Verdict: no blocking issues. Correctness
PerformanceThe gate passed and the target was met.
Suggestions (non-blocking)
TestsCoverage is good:
|
|
Claude finished @ajitpratap0's task in 15s —— View job Review of PR #962 (latest sync)I read the diff for Verdict: no blocking issues. Correctness
PerformanceThe gate passed and the target was met.
Suggestions (non-blocking)
TestsCoverage is good:
|
Summary
W6-06(c)+(d), D16 UNIVERSAL:
LintString(and all wrappers) now tokenizes into pooled scratch storage and releases the parsed AST after every rule set has run (custom, configured, subset, empty). AST,Context.Nodes(), tokens andWordpointers are borrowed only for the duration of eachRule.Check; documented onRule,Rule.Check,Context,Context.Nodes. Release is deferred so it also happens on rule error/panic. Returned violations/syntax errors stay valid.Changelog fragments:
changelog.d/w6-06cd-lint-release-ast.breaking-changes.md(migration note) andchangelog.d/w6-06cd-lint-release-ast.performance.md.Test Plan
task check,task test:cbinding,go test -count=1 ./pkg/compatibility/...,task changelog:check, staticcheck onpkg/linter/...+internal/tokscratch/...: all pass (re-run after the last commit).linter_lifetime_test.go, race on/off variants) and pool test updates.TestLintLifetimeScratchAllocationsnow also compares a tokscratch-only reference (128 allocs) against the owned-token reference (131), so a regression names both numbers (LintString itself: 130).task bench:ab BASE=origin/main BENCH='./pkg/linter=^BenchmarkLintRW$' ROUNDS=10 LAYOUTS=0): LintRW B/op -39.9% to -44.8% (geomean -41.59%), allocs/op -6.2% to -7.4% (geomean -6.80%), p=0.000 n=10 on all 8 dialects.Target met (LintRW B/op <= -15%: -39.9% to -44.8%). No gated regression, allocs/op not up, B/op not up. This run lists 20 benchmarks as low power (LintRW mariadb/snowflake/mysql/sqlite among them, spread 3.4-3.7%), so the LintRW time gains are corroborated by the deterministic B/op and allocs/op columns rather than time alone. The geomean time change is not significant (p 0.355). An earlier gate run on head 777f844 gave the same B/op and allocs/op and LintRW time -6.3% to -12.9%.
Retention audit (D16 UNIVERSAL: nothing may hold AST, token or Word references after
Check)Checkpkg/linter/rules/**(structs, package vars, Check/Fix)Fixworks from its SQL argument.pkg/linter/config/**Violation,FileResultinpkg/linterpkg/mcp/tools.go:334FileResultvalues.pkg/cbinding/cbinding_ext.go:449FileResultvalues (also gated bytask test:cbinding).wasm/internal/bridge/bridge.go:150FileResultvalues.cmd/gosqlx/cmd/lint.go:123/130/206/299/349/368FileResultvalues;--fixre-lints the fixed SQL.runSecurityScan(lint.go:427) parses and releases its own tree.actioncmd/action.go:355usesLintFile.pkg/lsp#566's objection (retention hazards of releasing the AST) no longer holds: D16 makes release universal and documents the borrowed-during-
Checkcontract onRule, so the earlier opt-out/ownership concern is replaced by an explicit contract plus a migration note, and every in-repo consumer was verified above.Breaking Changes
Rules that retain AST/token/node references past
Checkbreak. Migration note in CHANGELOG "Breaking Changes": materialize strings/scalars duringCheck, deep-copy, join goroutines, haveFixuse its SQL argument. Go signatures unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
Final gate before merge (merge train)
The perf gate ran on the final head
59dfd44bf756merged with current main: ## Perf gate: PASS (shadow mode: report only, this check never fails), report #962 (comment). This result replaces any earlier gate numbers in this description.