Skip to content

perf(linter): release AST and recycle tokens after Check for all rule sets [W6-06cd] - #962

Merged
ajitpratap0 merged 13 commits into
mainfrom
perf/w6-06cd-lint-release-ast
Nov 15, 2026
Merged

ajitpratap0 merged 13 commits into
mainfrom
perf/w6-06cd-lint-release-ast

Conversation

@ajitpratap0

@ajitpratap0 ajitpratap0 commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

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 and Word pointers are borrowed only for the duration of each Rule.Check; documented on Rule, 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) and changelog.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 on pkg/linter/... + internal/tokscratch/...: all pass (re-run after the last commit).
  • New lifetime tests (linter_lifetime_test.go, race on/off variants) and pool test updates. TestLintLifetimeScratchAllocations now also compares a tokscratch-only reference (128 allocs) against the owned-token reference (131), so a regression names both numbers (LintString itself: 130).
  • Local benchstat (indicative only, shared M4; 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.
  • CI amd64 layout-randomized perf gate on the final head (comment on this PR; base fb63e32, head 2b23659, 20 layouts/arm, A/A' control clean: 0/52 moved, geomean +0.42% p 0.265): PASS (shadow mode). Rows:
benchmark time p B/op allocs/op
LintRW/postgresql -7.54% <0.001 -41.88% 14797 -> 13762
LintRW/mysql -5.16% <0.001 -40.28% 18251 -> 16902
LintRW/mariadb -3.49% 0.005 -41.33% 16562 -> 15340
LintRW/sqlserver -6.40% <0.001 -44.74% 14525 -> 13631
LintRW/oracle -4.99% <0.001 -42.23% 17804 -> 16661
LintRW/sqlite -6.97% <0.001 -40.19% 16520 -> 15440
LintRW/snowflake -4.52% <0.001 -41.96% 16113 -> 15069
LintRW/clickhouse -7.10% <0.001 -39.93% 18657 -> 17339
LintParallel/lint -9.32% <0.001 -41.49% 133237 -> 124158
LintParallel/rules +1.13% 0.495 -0.00% 68933 -> 68933
geomean -0.53% 0.355

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)

Surface Checked Why no reference survives Check
Built-ins L001-L030 pkg/linter/rules/** (structs, package vars, Check/Fix) No struct fields or globals of AST, token, Word or Context type; no goroutines; Check does not mutate the receiver. Fix works from its SQL argument.
configuredRule pkg/linter/config/** Wraps a rule plus severity/options (values only); same checks as above.
Result types Violation, FileResult in pkg/linter Hold strings, ints, locations and errors by value only.
MCP pkg/mcp/tools.go:334 Consumes FileResult values.
cbinding pkg/cbinding/cbinding_ext.go:449 Consumes FileResult values (also gated by task test:cbinding).
WASM wasm/internal/bridge/bridge.go:150 Consumes FileResult values.
CLI lint cmd/gosqlx/cmd/lint.go:123/130/206/299/349/368 Consume FileResult values; --fix re-lints the fixed SQL. runSecurityScan (lint.go:427) parses and releases its own tree. actioncmd/action.go:355 uses LintFile.
LSP pkg/lsp Does not call the linter.

#566's objection (retention hazards of releasing the AST) no longer holds: D16 makes release universal and documents the borrowed-during-Check contract on Rule, 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 Check break. Migration note in CHANGELOG "Breaking Changes": materialize strings/scalars during Check, deep-copy, join goroutines, have Fix use 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 59dfd44bf756 merged 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.

Test and others added 2 commits November 12, 2026 14:36
@vercel

vercel Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
gosqlx-website Ignored Ignored Preview Nov 15, 2026 3:30pm UTC

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 27s —— View job


Review of PR #962

I read the diff and traced the lifetime ordering in LintString. I didn't run the tests or the benchmarks.

Verdict: looks good, with a few minor suggestions.

Correctness

  • Release order is right. Defers run last-in-first-out. ReleaseAST is deferred after PutParser and PutTokenizer, so it runs first. The tree is released before the parser is reset and before the tokenizer scratch is recycled. That matters because AST nodes may reference Word values owned by the tokenizer scratch.
  • Release also happens on error and panic. The early return result on a rule error and a panic from Check both run the defers.
  • The astObj != nil guard covers partial-parse and failed-parse trees. It also covers the case where the tree is nil.
  • Returned data stays valid. ParseError, TokenizeError and the violations are returned by value. Token strings are substrings of the input, as the tokscratch doc says.
  • ctx goes out of scope at return, so its Nodes() cache dies with it.

Risks

  1. This is a silent breaking change for third-party rules. A rule that keeps ctx.AST, a node, or a *Word now sees pooled memory that has been reset or reused. It gets no error and may read wrong data. The CHANGELOG and docs cover this well. The race-on test variants should catch in-repo cases, but external users will only find out at runtime. Consider a debug or -race-only poisoning mode that scribbles over released nodes, so retention bugs show up deterministically in rule authors' tests. If the lifetime tests already do this, mention it in the docs.
  2. Fix callers may be affected. Rule.Fix takes the SQL, but any rule that stores a Context for use in Fix now breaks. The docs mention this. It is worth confirming that the in-repo Fix implementations were checked too. The PR says the audit covered retained references generally.
  3. ast.ReleaseAST on a partial tree. Please confirm it is safe on trees returned alongside a non-nil parseErr. ParseFromModelTokens might return a tree that something else owns. The freshLint helper in the test now calls ReleaseAST(tree) unconditionally, including on the error path, so nil-safety matters there. It should be fine if ReleaseAST(nil) is a no-op.

Tests

  • Coverage is good. It adds the lifetime tests, race on/off variants, new edge inputs (multi-statement with an error, unterminated strings, non-ASCII identifiers), and a concurrent lifetimeSummary rule.
  • In linter_pool_test.go, freshLint uses defer ast.ReleaseAST(tree) inside a loop body (the break makes it run only once). It works, but moving it out of the loop would read more clearly.
  • The concurrent test calls t.Error from goroutines, which is fine. ReleaseAST(tree) after a failed parse could receive nil, which is the same point as risk 3.

Performance

  • Tokenizing into pooled scratch and releasing the AST should cut B/op as intended. The perf-gate result is still pending, so I can't confirm the -15% LintRW target. Please post the numbers when the gate finishes, and report them even if the target is missed, per the repo principles.

Nits

  • The tokscratch doc wording is slightly clumsy: "must not return the slice as an owned result". Consider "must not hand the slice to a caller that outlives the next tokenize call".
  • The Context doc says "AST, Tokens and Nodes results". Nodes() is a method, so say "AST, Tokens and Nodes() results".

No blocking issues. Please resolve the ReleaseAST nil and partial-tree check before merging.

@github-actions github-actions Bot added documentation Improvements or additions to documentation linter labels Nov 12, 2026
#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
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 18s —— View job


Review of PR #962

I read the diff and checked ast.ReleaseAST and the defer ordering in LintString. I didn't run the tests or benchmarks.

Verdict: looks good. I found nothing blocking.

Checked

  • ReleaseAST(nil) is safe. pkg/sql/ast/pool.go:559 returns early on nil, so the open question in the earlier review is settled. linter.go:257 also guards with astObj != nil, and the freshLint test helper can call it unconditionally.
  • Release order is correct. Defers run last-in-first-out. ReleaseAST (linter.go:258) is deferred after PutParser (:233) and PutTokenizer (:231), so the tree is released before the parser and the tokenizer scratch. The release also runs on a rule error or panic.
  • Partial trees are handled. The noPooledDraws branch releases trees that hold only heap-built nodes without putting them into pools. That makes release on a tree returned alongside a non-nil parseErr safe.

Suggestions (non-blocking)

  1. Silent breakage for third-party rules. A rule that keeps an AST, node or *Word will read pooled, reset memory with no error. Documentation covers this. A race-build "poison on release" mode would surface the retention bugs deterministically in rule authors' tests. If the lifetime tests already do something like that, say so in the Rule doc.
  2. freshLint in linter_pool_test.go:70. defer ast.ReleaseAST(tree) sits inside a loop that breaks after one iteration. It works, but it would read more clearly with the tree released explicitly after the loop.
  3. Doc wording.
    • The tokscratch text "must not return the slice as an owned result" could read "must not hand the slice to a caller that outlives the next tokenize call".
    • In the Context doc, write Nodes() as a method, not as "Nodes results".
  4. Perf evidence. The perf-gate verdict is still pending. Please post the benchstat numbers, even if the LintRW B/op ≤ -15% target is missed.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 16s —— View job


Review of PR #962

I read the full diff, including the LintString defer ordering and the tests. I didn't run the tests or benchmarks.

Verdict: no blocking issues. The only open item is the perf-gate result.

Correctness

  • Release order is right. ReleaseAST is deferred after PutParser and PutTokenizer. Defers run last-in-first-out, so the tree is released before the parser and the tokenizer scratch it may reference.
  • Panics and rule errors. A rule error or a panic in Check still runs the defers, so the AST is released in both cases.
  • Nil and partial trees. defer ast.ReleaseAST(astObj) sits behind an astObj != nil guard in LintString. The earlier review found ReleaseAST(nil) is a no-op. So freshLint and the test goroutines can call it unconditionally.
  • Returned data stays valid. Violations, ParseError and TokenizeError are returned by value. Token strings are substrings of the input.
  • Release scope. The defer is registered inside the if hasStatementTokens block, but defers are function-scoped. The release therefore happens when LintString returns, after all rule sets have run. That matches the docs.

Suggestions (non-blocking)

  1. Silent breakage for third-party rules. A rule that retains the AST, a node or a *Word reads recycled memory with no error. The docs describe the contract well. A race-build "poison on release" mode would surface retention bugs deterministically in rule authors' tests. If the lifetime tests already do something like this, say so in the Rule.Check doc.
  2. freshLint in linter_pool_test.go:70. defer ast.ReleaseAST(tree) sits in a loop that breaks after one iteration. It works, but it reads oddly. Release the tree explicitly after the loop, or move the parse out of the loop.
  3. Doc wording.
    • tokscratch still says "must not return the slice as an owned result". It could read "must not hand the slice to a caller that outlives the next tokenize call".
    • In the Context doc, write Nodes() as a method: "AST, Tokens and Nodes() results".
  4. Perf evidence. The PR body says the perf-gate verdict is pending. The target is LintRW B/op ≤ -15%. Please post the benchstat numbers, and report them even if the target is missed, per the repo's engineering principles.

Tests

Coverage is strong:

  • Lifetime tests with race-on and race-off variants.
  • New edge inputs: multi-statement input with an error, unterminated strings, and non-ASCII identifiers.
  • A concurrent summary rule.
  • fingerprint.Normalize added to the concurrent mix, which exercises the shared pools.
    · Branch: perf/w6-06cd-lint-release-ast

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Perf gate: PASS (shadow mode: report only, this check never fails)

Base e25fa96689e7, head 7055773a3922. 20 interleaved rounds, 20 randomized code layouts per arm (-randlayout seeds 437302255882..437302255901; A/A' 437302255902..437302255921), benchtime 100ms, -cpu 1, GOMEMLIMIT 64MiB, pinned to CPU 3 (SMT siblings 2-3) with taskset. adaptive layouts: budget 600s, cap 200; 62 planned benchmarks extended to up to 78 layouts, 4 line warm-ups, in 1 stage(s), 602s, budget.

Runner CPU: AMD EPYC 9V45 96-Core Processor (x86_64). Base and head ran interleaved in this job, so the tables show their ratios only; absolute timings (raw files in the artifact) hold for this CPU and this job alone and are never compared across jobs.

  • 12 benchmark(s) faster by 3% or more

Rules: each arm runs 20 randomized code layouts (-ldflags=-randlayout); time regresses at >= +3% when significant at a false discovery rate of 0.01 over the suite (Benjamini-Hochberg on exact Mann-Whitney U p-values of the per-layout medians, so a regression must hold across layouts, not within one binary), or a suite geomean >= +1.5% (per-layout suite geomeans, same test); allocs/op must not increase; B/op must not rise more than 2%; instructions/op must not rise more than 1.5%. The A/A' control runs the base revision under a disjoint set of layout seeds; when more than 10% of benchmarks move over 3% in it, the run is noisy: re-run once, then inconclusive (neutral). Benchmarks under 80% estimated power for a lone +5% slowdown at alpha/m get extra layouts (adaptive, budget-limited); plans size to 90% estimated power, and time is judged over all of each benchmark's 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)

benchmark time p A/A' spread K power B/op allocs/op status
ParseE2E/simple_select -0.34% 0.560 -0.27% 3.52% 73 100% +0.00% 3 → 3 ok
ParseE2E/select_where -0.15% 0.822 -1.52% 2.51% 29 91% +0.00% 16 → 16 ok
ParseE2E/join -0.74% 0.275 -1.06% 3.12% 31 89% +0.00% 15 → 15 ok
ParseE2E/aggregate +1.13% 0.226 -0.75% 4.60% 41 85% +0.00% 13 → 13 ok
ParseE2E/subquery -0.40% 0.478 +0.03% 2.78% 27 91% +0.00% 10 → 10 ok
ParseE2E/cte +0.07% 0.936 +0.42% 4.06% 39 74% +0.00% 16 → 16 ok
ParseE2E/window +0.00% 0.997 +0.06% 3.90% 53 91% +0.00% 9 → 9 ok
ParseE2E/complex +0.64% 0.359 -0.68% 2.11% 27 92% +0.00% 43 → 43 ok
ParseE2E/insert -1.85% 0.040 -1.10% 6.23% 67 85% +0.00% 17 → 17 ok
ParseE2E/update +0.00% 0.989 -0.72% 6.15% 73 94% +0.00% 13 → 13 ok
ParseE2E/delete -1.22% 0.171 -0.65% 2.23% 29 93% +0.00% 5 → 5 ok
ParseRW/postgresql/medium -0.44% 0.325 +1.70% 2.60% 78 100% +0.00% 583 → 583 ok
ParseRW/mysql/medium -0.52% 0.562 -0.80% 4.69% 44 84% +0.00% 334 → 334 ok
ParseRW/mariadb/medium -0.97% 0.239 -0.98% 2.78% 31 83% -0.00% 470 → 470 ok
ParseRW/sqlserver/medium +0.69% 0.385 +0.24% 5.66% 66 91% +0.00% 853 → 853 ok
ParseRW/oracle/medium -0.88% 0.270 -0.23% 5.32% 78 94% +0.00% 962 → 962 ok
ParseRW/sqlite/medium +0.37% 0.654 -0.76% 3.56% 29 91% +0.00% 318 → 318 ok
ParseRW/snowflake/medium +1.27% 0.081 +0.88% 2.47% 31 89% +0.00% 630 → 630 ok
ParseRW/clickhouse/medium +1.41% 0.063 +0.67% 2.43% 20 86% +0.00% 336 → 336 ok
ParseFresh/simple_select -0.05% 0.933 +0.38% 2.39% 36 98% +0.00% 4 → 4 ok
ParseFresh/join -1.84% 0.025 -0.70% 2.78% 27 87% +0.00% 16 → 16 ok
ParseFresh/complex -0.52% 0.502 -0.22% 2.19% 28 93% +0.00% 44 → 44 ok
ParseFresh/insert -0.17% 0.852 -0.86% 2.50% 33 93% +0.00% 18 → 18 ok
ParseFresh/update +0.49% 0.594 -0.66% 3.12% 34 93% +0.00% 14 → 14 ok
ParseFresh/delete +0.66% 0.492 -1.47% 3.45% 36 88% +0.00% 6 → 6 ok
PoolGetPut/serial -0.72% 0.279 -0.72% 2.61% 20 82% +0.00% 0 → 0 ok
Tokenize/scratch/join +0.15% 0.860 -1.10% 4.04% 65 96% +0.00% 0 → 0 ok
Tokenize/scratch/complex -0.32% 0.707 -1.39% 4.08% 42 88% +0.00% 0 → 0 ok
Tokenize/scratch/insert -1.25% 0.186 -4.15% 5.39% 65 80% +0.00% 0 → 0 ok
Normalize/simple_select -0.76% 0.171 -0.69% 1.90% 25 92% +0.00% 5 → 5 ok
Normalize/join -0.52% 0.455 -0.01% 3.08% 25 90% +0.00% 21 → 21 ok
Normalize/complex -0.50% 0.464 +0.04% 1.74% 25 93% +0.00% 62 → 62 ok
TransformParse/simple_select -0.52% 0.415 -0.63% 2.62% 53 100% +0.00% 3 → 3 ok
TransformParse/join -0.21% 0.823 -0.16% 4.71% 53 97% +0.00% 15 → 15 ok
TransformParse/complex -1.21% 0.157 -0.98% 2.75% 32 94% +0.00% 43 → 43 ok
LintParallel/rules -0.49% 0.562 -0.39% 2.55% 30 90% -0.00% 68933 → 68933 ok
LintParallel/lint -6.63% <0.001 +0.63% 2.63% 30 91% -42.06% 126674 → 117598 faster, -allocs
LintRW/postgresql -5.77% <0.001 +0.47% 2.18% 31 98% -42.44% 14129 → 13094 faster, -allocs
LintRW/mysql -6.02% <0.001 +0.34% 2.25% 26 89% -40.76% 17456 → 16107 faster, -allocs
LintRW/mariadb -7.06% <0.001 -0.51% 2.72% 20 83% -41.92% 15755 → 14533 faster, -allocs
LintRW/sqlserver -5.63% <0.001 -0.04% 2.39% 20 85% -45.31% 13870 → 12976 faster, -allocs
LintRW/oracle -4.31% <0.001 -0.75% 1.88% 26 93% -42.82% 16857 → 15714 faster, -allocs
LintRW/sqlite -6.80% <0.001 +0.34% 3.11% 26 92% -40.78% 15738 → 14658 faster, -allocs
LintRW/snowflake -6.59% <0.001 +1.95% 2.76% 31 89% -42.56% 15204 → 14160 faster, -allocs
LintRW/clickhouse -5.91% <0.001 +0.53% 2.13% 31 92% -40.52% 17660 → 16342 faster, -allocs
LintRule/L007 -0.35% 0.550 -0.15% 2.77% 78 100% +0.00% 1194 → 1194 ok
LintRule/L010 +0.33% 0.778 -2.18% 10.16% 78 54% +0.00% 0 → 0 ok
ParseError/syntax_mid/parse -0.59% 0.143 -1.03% 2.36% 78 100% +0.00% 11 → 11 ok
ParseError/syntax_mid/validate +0.08% 0.851 -0.08% 3.47% 32 88% +0.00% 11 → 11 ok
ParseError/syntax_end/parse +0.77% 0.347 +0.87% 3.01% 32 91% +0.00% 14 → 14 ok
ParseError/syntax_end/validate -0.20% 0.803 -0.32% 3.68% 46 91% +0.00% 14 → 14 ok
ParseError/tokenize/parse -0.45% 0.622 -0.38% 5.87% 78 83% +0.00% 4 → 4 ok
ParseError/tokenize/validate -0.99% 0.174 -0.93% 2.57% 27 89% +0.00% 21 → 21 ok
ParseError/long_prefix/parse -0.35% 0.646 -0.95% 4.88% 78 91% -0.01% 213 → 213 ok
ParseError/long_prefix/validate -0.44% 0.592 -0.18% 5.07% 52 85% +0.00% 213 → 213 ok
WASMBridge/parse/small -0.40% 0.424 +0.25% 1.25% 39 100% +0.00% 8 → 8 ok
WASMBridge/parse/medium -0.20% 0.783 -0.00% 2.73% 39 93% +0.00% 38 → 38 ok
WASMBridge/parse/large +0.22% 0.842 +0.31% 3.02% 27 90% +0.00% 522 → 522 ok
WASMBridge/lint/small -5.07% <0.001 -0.79% 2.16% 20 80% -38.26% 33 → 30 faster, -allocs
WASMBridge/lint/medium -7.18% <0.001 +0.64% 3.85% 33 85% -52.27% 100 → 97 faster, -allocs
WASMBridge/lint/large -3.82% <0.001 -0.41% 2.95% 35 86% -40.68% 1031 → 1026 faster, -allocs
DetectDialect/empty -0.55% 0.606 +3.46% 16.79% 78 28% +0.00% 0 → 0 ok
DetectDialect/generic -0.07% 0.967 -0.73% 3.24% 55 94% +0.00% 0 → 0 ok
DetectDialect/postgresql +0.00% 1.000 -0.38% 3.60% 78 99% +0.00% 0 → 0 ok
DetectDialect/mysql +0.98% 0.208 -0.37% 4.51% 78 97% +0.00% 0 → 0 ok
DetectDialect/sqlserver +0.00% 0.990 -0.55% 4.73% 70 96% +0.00% 0 → 0 ok
DetectDialect/oracle -0.12% 0.877 -1.73% 4.58% 78 94% +0.00% 0 → 0 ok
DetectDialect/snowflake -0.47% 0.520 -1.14% 4.24% 78 97% +0.00% 0 → 0 ok
DetectDialect/mariadb -0.59% 0.479 -1.90% 4.93% 78 97% +0.00% 0 → 0 ok
DetectDialect/mixed +0.14% 0.879 -0.46% 2.94% 58 96% +0.00% 0 → 0 ok
DetectDialect/large_64KB +0.31% 0.751 +0.10% 4.37% 40 90% +0.00% 0 → 0 ok
geomean -1.35% <0.001 -0.36%

time and A/A' are Hodges-Lehmann shifts over the per-layout medians. spread: the base arm's robust standard deviation across its layouts (1.4826 x MAD, relative), i.e. how much this benchmark moves between builds that differ only in function placement, plus run-to-run noise; K is layouts per arm. Power uses Noether's normal approximation with the effect size taken from the data: AUC = P(head layout slower than base layout) under a +5% shift over pooled within-arm residuals, a conservative estimate. Plans size to 90% estimated power while the stopping target remains 80%.

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 power

Adaptive 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.

benchmark K power at +5% slowdown caught 80% of the time reason
DetectDialect/empty 78 28% +12.4% time budget ran out
LintRule/L010 78 54% +6.2% time budget ran out
ParseE2E/cte 39 74% +5.3% time budget ran out

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)

case instructions/op status
e2e/aggregate +0.03% ok
e2e/complex -0.01% ok
e2e/cte +0.01% ok
e2e/delete +0.17% ok
e2e/insert -0.04% ok
e2e/join -0.05% ok
e2e/select_where +0.05% ok
e2e/simple_select +0.03% ok
e2e/subquery +0.10% ok
e2e/update +0.02% ok
e2e/window -0.01% ok
rw/postgresql/medium -0.03% ok
Secondary metric: default GC, GOMAXPROCS=1 (informational)
benchmark time p
ParseE2E/simple_select -0.05% 0.971
ParseE2E/select_where +0.12% 0.853
ParseE2E/join +1.14% 0.545
ParseE2E/aggregate -0.41% 0.650
ParseE2E/subquery -0.90% 0.481
ParseE2E/cte -1.17% 0.481
ParseE2E/window -0.28% 0.910
ParseE2E/complex +0.74% 0.393
ParseE2E/insert -0.61% 0.733
ParseE2E/update +0.36% 0.649
ParseE2E/delete +0.27% 0.853
ParseRW/postgresql/medium +1.11% 0.165
ParseRW/mysql/medium +0.62% 0.481
ParseRW/mariadb/medium -0.30% 0.529
ParseRW/sqlserver/medium -0.72% 0.353
ParseRW/oracle/medium +0.94% 0.247
ParseRW/sqlite/medium +2.11% 0.190
ParseRW/snowflake/medium -2.70% 0.011
ParseRW/clickhouse/medium -0.13% 0.912
ParseFresh/simple_select -0.12% 0.971
ParseFresh/join -0.79% 0.579
ParseFresh/complex +0.27% 0.762
ParseFresh/insert -0.16% 0.970
ParseFresh/update +0.59% 0.650
ParseFresh/delete +1.22% 0.280
PoolGetPut/serial -0.12% 0.971
Tokenize/scratch/join +0.58% 0.912
Tokenize/scratch/complex -2.36% 0.529
Tokenize/scratch/insert +0.76% 0.739
Normalize/simple_select -0.91% 0.597
Normalize/join -0.45% 0.473
Normalize/complex +1.27% 0.315
TransformParse/simple_select +1.11% 0.579
TransformParse/join -1.88% 0.190
TransformParse/complex -2.68% 0.105
LintParallel/rules -1.57% 0.393
LintParallel/lint -6.78% <0.001
LintRW/postgresql -5.04% <0.001
LintRW/mysql -0.79% 0.529
LintRW/mariadb -5.49% <0.001
LintRW/sqlserver -4.74% <0.001
LintRW/oracle -5.05% 0.004
LintRW/sqlite -5.59% <0.001
LintRW/snowflake -6.20% 0.003
LintRW/clickhouse -4.26% <0.001
LintRule/L007 +0.40% 0.912
LintRule/L010 +4.55% 0.393
ParseError/syntax_mid/parse -1.11% 0.307
ParseError/syntax_mid/validate -0.37% 0.734
ParseError/syntax_end/parse -1.23% 0.364
ParseError/syntax_end/validate +0.46% 0.762
ParseError/tokenize/parse +2.50% 0.393
ParseError/tokenize/validate +1.99% 0.045
ParseError/long_prefix/parse +0.01% 0.940
ParseError/long_prefix/validate +1.19% 0.529
WASMBridge/parse/small -0.07% 0.940
WASMBridge/parse/medium +0.38% 0.971
WASMBridge/parse/large +1.26% 0.353
WASMBridge/lint/small -3.48% 0.016
WASMBridge/lint/medium -2.44% 0.143
WASMBridge/lint/large -1.09% 0.190
DetectDialect/empty -0.58% 0.850
DetectDialect/generic -0.03% 1.000
DetectDialect/postgresql -0.73% 0.853
DetectDialect/mysql +1.22% 0.853
DetectDialect/sqlserver +1.69% 0.436
DetectDialect/oracle +1.56% 0.481
DetectDialect/snowflake -1.11% 0.406
DetectDialect/mariadb -0.86% 0.684
DetectDialect/mixed -0.97% 0.762
DetectDialect/large_64KB +0.03% 1.000
geomean -0.67%
Environment
date:        2026-11-15T15:35:08Z
base:        e25fa96689e772a2c9c48fdd837cbcb9b03e66eb
head:        working tree of 7055773a3922e5270697192eb3793e916a72a109
cpu model:   AMD EPYC 9V45 96-Core Processor (x86_64)
go:          go version go1.26.9 linux/amd64
kernel:      Linux 7.0.0-1017-azure x86_64
layouts:     20 per arm, -ldflags=-randlayout seeds 437302255882..437302255901 (base, head), 437302255902..437302255921 (A/A')
pinning:     pinned to CPU 3 (SMT siblings 2-3) with taskset
gcoff env:   GOGC=off GOMEMLIMIT=64MiB
clocksource: tsc
load:        7.49, 2.74, 1.00
instr count: cachegrind
perf probe:  Error: No supported events found. The instructions:u event is not supported. 

Architecture:                            x86_64
CPU(s):                                  4
Model name:                              AMD EPYC 9V45 96-Core Processor
Thread(s) per core:                      2
Core(s) per socket:                      2
Socket(s):                               1
Hypervisor vendor:                       Microsoft
L1d cache:                               96 KiB (2 instances)
L1i cache:                               64 KiB (2 instances)
L2 cache:                                2 MiB (2 instances)
L3 cache:                                32 MiB (1 instance)
extension:   1 stage(s), layouts 21..78, seeds 437302255922..437302255979, 602s, budget
benchstat (primary metric, samples pooled across layouts: informational, the verdict uses the per-layout test)
goos: linux
goarch: amd64
pkg: github.com/ajitpratap0/GoSQLX/pkg/fingerprint
cpu: AMD EPYC 9V45 96-Core Processor                
                        │    base     │                head                │
                        │   sec/op    │   sec/op     vs base               │
Normalize/simple_select   1.320µ ± 1%   1.315µ ± 1%       ~ (p=0.465 n=20)
Normalize/join            3.931µ ± 2%   3.942µ ± 2%       ~ (p=0.616 n=20)
Normalize/complex         10.65µ ± 2%   10.53µ ± 2%       ~ (p=0.461 n=20)
geomean                   3.809µ        3.794µ       -0.40%

                        │     base     │                 head                  │
                        │     B/op     │     B/op      vs base                 │
Normalize/simple_select     784.0 ± 0%     784.0 ± 0%       ~ (p=1.000 n=20) ¹
Normalize/join            2.164Ki ± 0%   2.164Ki ± 0%       ~ (p=1.000 n=20) ¹
Normalize/complex         5.977Ki ± 0%   5.977Ki ± 0%       ~ (p=1.000 n=20) ¹
geomean                   2.147Ki        2.147Ki       +0.00%
¹ all samples are equal

                        │    base    │                head                 │
                        │ allocs/op  │ allocs/op   vs base                 │
Normalize/simple_select   5.000 ± 0%   5.000 ± 0%       ~ (p=1.000 n=20) ¹
Normalize/join            21.00 ± 0%   21.00 ± 0%       ~ (p=1.000 n=20) ¹
Normalize/complex         62.00 ± 0%   62.00 ± 0%       ~ (p=1.000 n=20) ¹
geomean                   18.67        18.67       +0.00%
¹ all samples are equal

pkg: github.com/ajitpratap0/GoSQLX/pkg/gosqlx
                                │    base     │                head                │
                                │   sec/op    │   sec/op     vs base               │
ParseE2E/simple_select            852.4n ± 2%   862.6n ± 1%       ~ (p=0.713 n=20)
ParseE2E/select_where             2.021µ ± 2%   2.006µ ± 2%       ~ (p=0.703 n=20)
ParseE2E/join                     2.674µ ± 2%   2.639µ ± 2%       ~ (p=0.092 n=20)
ParseE2E/aggregate                2.082µ ± 3%   2.065µ ± 3%       ~ (p=0.763 n=20)
ParseE2E/subquery                 1.759µ ± 3%   1.756µ ± 1%       ~ (p=0.857 n=20)
ParseE2E/cte                      2.642µ ± 3%   2.665µ ± 4%       ~ (p=0.516 n=20)
ParseE2E/window                   1.708µ ± 3%   1.710µ ± 4%       ~ (p=0.616 n=20)
ParseE2E/complex                  7.157µ ± 2%   7.194µ ± 1%       ~ (p=0.351 n=20)
ParseE2E/insert                   1.329µ ± 4%   1.308µ ± 7%       ~ (p=0.899 n=20)
ParseE2E/update                   1.185µ ± 5%   1.168µ ± 3%       ~ (p=0.457 n=20)
ParseE2E/delete                   751.3n ± 2%   730.8n ± 4%       ~ (p=0.151 n=20)
ParseRW/postgresql/medium         81.76µ ± 4%   82.52µ ± 2%       ~ (p=0.165 n=20)
ParseRW/mysql/medium              50.16µ ± 4%   50.57µ ± 3%       ~ (p=0.925 n=20)
ParseRW/mariadb/medium            70.04µ ± 2%   70.14µ ± 3%       ~ (p=0.968 n=20)
ParseRW/sqlserver/medium          137.6µ ± 6%   133.0µ ± 5%       ~ (p=0.820 n=20)
ParseRW/oracle/medium             164.2µ ± 5%   162.9µ ± 9%       ~ (p=0.968 n=20)
ParseRW/sqlite/medium             41.14µ ± 3%   41.65µ ± 1%       ~ (p=0.478 n=20)
ParseRW/snowflake/medium          102.2µ ± 2%   103.4µ ± 2%       ~ (p=0.072 n=20)
ParseRW/clickhouse/medium         47.44µ ± 2%   48.19µ ± 1%       ~ (p=0.063 n=20)
ParseFresh/simple_select          1.818µ ± 2%   1.844µ ± 2%       ~ (p=0.635 n=20)
ParseFresh/join                   3.748µ ± 2%   3.622µ ± 3%       ~ (p=0.016 n=20)
ParseFresh/complex                7.713µ ± 2%   7.586µ ± 2%       ~ (p=0.473 n=20)
ParseFresh/insert                 2.371µ ± 2%   2.362µ ± 4%       ~ (p=0.973 n=20)
ParseFresh/update                 2.249µ ± 3%   2.282µ ± 3%       ~ (p=0.224 n=20)
ParseFresh/delete                 1.831µ ± 3%   1.825µ ± 2%       ~ (p=0.774 n=20)
PoolGetPut/serial                 60.50n ± 2%   60.12n ± 2%       ~ (p=0.280 n=20)
ParseError/syntax_mid/parse       1.355µ ± 3%   1.346µ ± 1%       ~ (p=0.189 n=20)
ParseError/syntax_mid/validate    1.238µ ± 4%   1.236µ ± 1%       ~ (p=0.846 n=20)
ParseError/syntax_end/parse       1.536µ ± 2%   1.524µ ± 2%       ~ (p=0.380 n=20)
ParseError/syntax_end/validate    1.505µ ± 3%   1.493µ ± 3%       ~ (p=0.490 n=20)
ParseError/tokenize/parse         507.4n ± 2%   510.1n ± 4%       ~ (p=0.758 n=20)
ParseError/tokenize/validate      1.611µ ± 1%   1.601µ ± 2%       ~ (p=0.703 n=20)
ParseError/long_prefix/parse      32.90µ ± 6%   33.10µ ± 7%       ~ (p=0.947 n=20)
ParseError/long_prefix/validate   32.43µ ± 9%   32.29µ ± 2%       ~ (p=0.327 n=20)
geomean                           4.729µ        4.714µ       -0.31%

                                │     base     │                head                 │
                                │     B/s      │     B/s       vs base               │
ParseE2E/simple_select            29.09Mi ± 2%   28.74Mi ± 2%       ~ (p=0.713 n=20)
ParseE2E/select_where             48.61Mi ± 2%   48.96Mi ± 2%       ~ (p=0.713 n=20)
ParseE2E/join                     44.95Mi ± 2%   45.53Mi ± 2%       ~ (p=0.095 n=20)
ParseE2E/aggregate                38.48Mi ± 3%   38.80Mi ± 3%       ~ (p=0.779 n=20)
ParseE2E/subquery                 44.46Mi ± 3%   44.54Mi ± 1%       ~ (p=0.878 n=20)
ParseE2E/cte                      44.77Mi ± 3%   44.38Mi ± 5%       ~ (p=0.512 n=20)
ParseE2E/window                   52.50Mi ± 3%   52.43Mi ± 4%       ~ (p=0.607 n=20)
ParseE2E/complex                  50.37Mi ± 2%   50.12Mi ± 1%       ~ (p=0.351 n=20)
ParseE2E/insert                   54.56Mi ± 4%   55.43Mi ± 6%       ~ (p=0.904 n=20)
ParseE2E/update                   44.27Mi ± 5%   44.91Mi ± 3%       ~ (p=0.473 n=20)
ParseE2E/delete                   66.00Mi ± 2%   67.86Mi ± 4%       ~ (p=0.155 n=20)
ParseRW/postgresql/medium         43.88Mi ± 4%   43.48Mi ± 2%       ~ (p=0.165 n=20)
ParseRW/mysql/medium              53.96Mi ± 3%   53.52Mi ± 3%       ~ (p=0.920 n=20)
ParseRW/mariadb/medium            50.62Mi ± 2%   50.55Mi ± 3%       ~ (p=0.941 n=20)
ParseRW/sqlserver/medium          48.38Mi ± 6%   50.03Mi ± 5%       ~ (p=0.825 n=20)
ParseRW/oracle/medium             51.04Mi ± 5%   51.47Mi ± 8%       ~ (p=0.962 n=20)
ParseRW/sqlite/medium             50.21Mi ± 3%   49.60Mi ± 1%       ~ (p=0.457 n=20)
ParseRW/snowflake/medium          49.73Mi ± 2%   49.14Mi ± 2%       ~ (p=0.071 n=20)
ParseRW/clickhouse/medium         47.50Mi ± 2%   46.76Mi ± 1%       ~ (p=0.064 n=20)
ParseError/syntax_mid/parse       33.80Mi ± 3%   34.02Mi ± 1%       ~ (p=0.194 n=20)
ParseError/syntax_mid/validate    36.98Mi ± 4%   37.04Mi ± 1%       ~ (p=0.841 n=20)
ParseError/syntax_end/parse       24.21Mi ± 2%   24.41Mi ± 2%       ~ (p=0.372 n=20)
ParseError/syntax_end/validate    24.71Mi ± 3%   24.91Mi ± 3%       ~ (p=0.490 n=20)
ParseError/tokenize/parse         86.45Mi ± 3%   86.00Mi ± 3%       ~ (p=0.758 n=20)
ParseError/tokenize/validate      27.23Mi ± 1%   27.40Mi ± 2%       ~ (p=0.713 n=20)
ParseError/long_prefix/parse      70.21Mi ± 6%   69.78Mi ± 6%       ~ (p=0.947 n=20)
ParseError/long_prefix/validate   71.23Mi ± 8%   71.54Mi ± 2%       ~ (p=0.324 n=20)
geomean                           45.64Mi        45.75Mi       +0.25%

                                │      base      │                 head                  │
                                │      B/op      │     B/op      vs base                 │
ParseE2E/simple_select              704.0 ± 0%       704.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/select_where             1.477Ki ± 0%     1.477Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/join                     1.789Ki ± 0%     1.789Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/aggregate                1.719Ki ± 0%     1.719Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/subquery                 1.609Ki ± 0%     1.609Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/cte                      2.070Ki ± 0%     2.070Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/window                   1.234Ki ± 0%     1.234Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/complex                  4.884Ki ± 0%     4.884Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/insert                     824.0 ± 0%       824.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/update                     736.0 ± 0%       736.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/delete                     400.0 ± 0%       400.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseRW/postgresql/medium         64.39Ki ± 0%     64.39Ki ± 0%       ~ (p=0.831 n=20)
ParseRW/mysql/medium              40.69Ki ± 0%     40.69Ki ± 0%       ~ (p=1.000 n=20)
ParseRW/mariadb/medium            58.50Ki ± 0%     58.50Ki ± 0%       ~ (p=0.352 n=20)
ParseRW/sqlserver/medium          81.24Ki ± 0%     81.24Ki ± 0%       ~ (p=0.230 n=20)
ParseRW/oracle/medium             100.9Ki ± 0%     100.9Ki ± 0%       ~ (p=0.916 n=20)
ParseRW/sqlite/medium             37.30Ki ± 0%     37.30Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseRW/snowflake/medium          73.29Ki ± 0%     73.29Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseRW/clickhouse/medium         32.99Ki ± 0%     32.99Ki ± 0%       ~ (p=0.342 n=20)
ParseFresh/simple_select            784.0 ± 0%       784.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseFresh/join                   1.867Ki ± 0%     1.867Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseFresh/complex                4.961Ki ± 0%     4.961Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseFresh/insert                   904.0 ± 0%       904.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseFresh/update                   816.0 ± 0%       816.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseFresh/delete                   480.0 ± 0%       480.0 ± 0%       ~ (p=1.000 n=20) ¹
PoolGetPut/serial                   0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/syntax_mid/parse         552.0 ± 0%       552.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/syntax_mid/validate      552.0 ± 0%       552.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/syntax_end/parse       1.320Ki ± 0%     1.320Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseError/syntax_end/validate    1.320Ki ± 0%     1.320Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseError/tokenize/parse           272.0 ± 0%       272.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/tokenize/validate      1.758Ki ± 0%     1.758Ki ± 0%       ~ (p=1.000 n=20) ¹
ParseError/long_prefix/parse      17.11Ki ± 0%     17.11Ki ± 0%       ~ (p=0.188 n=20)
ParseError/long_prefix/validate   17.07Ki ± 0%     17.07Ki ± 0%       ~ (p=1.000 n=20) ¹
geomean                                        ²                 -0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                │     base     │                head                 │
                                │  allocs/op   │ allocs/op   vs base                 │
ParseE2E/simple_select            3.000 ± 0%     3.000 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/select_where             16.00 ± 0%     16.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/join                     15.00 ± 0%     15.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/aggregate                13.00 ± 0%     13.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/subquery                 10.00 ± 0%     10.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/cte                      16.00 ± 0%     16.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/window                   9.000 ± 0%     9.000 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/complex                  43.00 ± 0%     43.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/insert                   17.00 ± 0%     17.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/update                   13.00 ± 0%     13.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseE2E/delete                   5.000 ± 0%     5.000 ± 0%       ~ (p=1.000 n=20) ¹
ParseRW/postgresql/medium         583.0 ± 0%     583.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseRW/mysql/medium              334.0 ± 0%     334.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseRW/mariadb/medium            470.0 ± 0%     470.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseRW/sqlserver/medium          853.0 ± 0%     853.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseRW/oracle/medium             962.0 ± 0%     962.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseRW/sqlite/medium             318.0 ± 0%     318.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseRW/snowflake/medium          630.0 ± 0%     630.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseRW/clickhouse/medium         336.0 ± 0%     336.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseFresh/simple_select          4.000 ± 0%     4.000 ± 0%       ~ (p=1.000 n=20) ¹
ParseFresh/join                   16.00 ± 0%     16.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseFresh/complex                44.00 ± 0%     44.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseFresh/insert                 18.00 ± 0%     18.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseFresh/update                 14.00 ± 0%     14.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseFresh/delete                 6.000 ± 0%     6.000 ± 0%       ~ (p=1.000 n=20) ¹
PoolGetPut/serial                 0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/syntax_mid/parse       11.00 ± 0%     11.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/syntax_mid/validate    11.00 ± 0%     11.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/syntax_end/parse       14.00 ± 0%     14.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/syntax_end/validate    14.00 ± 0%     14.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/tokenize/parse         4.000 ± 0%     4.000 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/tokenize/validate      21.00 ± 0%     21.00 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/long_prefix/parse      213.0 ± 0%     213.0 ± 0%       ~ (p=1.000 n=20) ¹
ParseError/long_prefix/validate   213.0 ± 0%     213.0 ± 0%       ~ (p=1.000 n=20) ¹
geomean                                      ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                          │    base     │                head                │
                          │  sec/stmt   │  sec/stmt    vs base               │
ParseRW/postgresql/medium   6.814µ ± 4%   6.876µ ± 2%       ~ (p=0.165 n=20)
ParseRW/mysql/medium        6.269µ ± 4%   6.321µ ± 3%       ~ (p=0.920 n=20)
ParseRW/mariadb/medium      7.783µ ± 2%   7.793µ ± 3%       ~ (p=0.952 n=20)
ParseRW/sqlserver/medium    6.551µ ± 6%   6.335µ ± 5%       ~ (p=0.815 n=20)
ParseRW/oracle/medium       6.843µ ± 5%   6.786µ ± 9%       ~ (p=0.973 n=20)
ParseRW/sqlite/medium       6.857µ ± 3%   6.942µ ± 1%       ~ (p=0.474 n=20)
ParseRW/snowflake/medium    7.864µ ± 2%   7.957µ ± 2%       ~ (p=0.071 n=20)
ParseRW/clickhouse/medium   6.777µ ± 2%   6.885µ ± 1%       ~ (p=0.060 n=20)
geomean                     6.950µ        6.965µ       +0.21%

pkg: github.com/ajitpratap0/GoSQLX/pkg/linter
                   │    base     │                head                │
                   │   sec/op    │   sec/op     vs base               │
LintParallel/rules   13.52m ± 3%   13.34m ± 2%       ~ (p=0.221 n=20)
LintParallel/lint    23.25m ± 2%   21.72m ± 3%  -6.62% (p=0.000 n=20)
LintRW/postgresql    2.805m ± 1%   2.648m ± 1%  -5.62% (p=0.000 n=20)
LintRW/mysql         3.144m ± 1%   2.965m ± 2%  -5.71% (p=0.000 n=20)
LintRW/mariadb       2.875m ± 2%   2.681m ± 2%  -6.76% (p=0.000 n=20)
LintRW/sqlserver     2.712m ± 2%   2.553m ± 2%  -5.86% (p=0.000 n=20)
LintRW/oracle        3.269m ± 2%   3.115m ± 0%  -4.72% (p=0.000 n=20)
LintRW/sqlite        2.680m ± 2%   2.485m ± 1%  -7.28% (p=0.000 n=20)
LintRW/snowflake     2.784m ± 2%   2.602m ± 3%  -6.54% (p=0.000 n=20)
LintRW/clickhouse    3.128m ± 2%   2.940m ± 1%  -6.02% (p=0.000 n=20)
LintRule/L007        1.723m ± 2%   1.698m ± 2%       ~ (p=0.369 n=20)
LintRule/L010        560.7µ ± 4%   541.2µ ± 5%       ~ (p=0.102 n=20)
geomean              3.287m        3.119m       -5.13%

                  │     base     │                head                 │
                  │     B/s      │     B/s       vs base               │
LintRW/postgresql   10.09Mi ± 1%   10.70Mi ± 1%  +5.95% (p=0.000 n=20)
LintRW/mysql        10.40Mi ± 1%   11.03Mi ± 3%  +6.05% (p=0.000 n=20)
LintRW/mariadb      10.61Mi ± 2%   11.38Mi ± 2%  +7.24% (p=0.000 n=20)
LintRW/sqlserver    11.43Mi ± 2%   12.14Mi ± 2%  +6.17% (p=0.000 n=20)
LintRW/oracle       12.15Mi ± 2%   12.75Mi ± 0%  +4.95% (p=0.000 n=20)
LintRW/sqlite       10.71Mi ± 2%   11.55Mi ± 1%  +7.88% (p=0.000 n=20)
LintRW/snowflake    11.20Mi ± 2%   11.99Mi ± 3%  +7.02% (p=0.000 n=20)
LintRW/clickhouse   10.38Mi ± 2%   11.04Mi ± 1%  +6.39% (p=0.000 n=20)
geomean             10.85Mi        11.55Mi       +6.45%

                   │      base      │                  head                  │
                   │      B/op      │     B/op      vs base                  │
LintParallel/rules   5.559Mi ± 0%     5.559Mi ± 0%        ~ (p=0.805 n=20)
LintParallel/lint    17.95Mi ± 0%     10.40Mi ± 0%  -42.06% (p=0.000 n=20)
LintRW/postgresql    1.966Mi ± 0%     1.131Mi ± 0%  -42.44% (p=0.000 n=20)
LintRW/mysql         2.508Mi ± 0%     1.486Mi ± 0%  -40.76% (p=0.000 n=20)
LintRW/mariadb       2.280Mi ± 0%     1.324Mi ± 0%  -41.92% (p=0.000 n=20)
LintRW/sqlserver     1.971Mi ± 0%     1.078Mi ± 0%  -45.31% (p=0.000 n=20)
LintRW/oracle        2.435Mi ± 0%     1.392Mi ± 0%  -42.82% (p=0.000 n=20)
LintRW/sqlite        2.173Mi ± 0%     1.287Mi ± 0%  -40.78% (p=0.000 n=20)
LintRW/snowflake     2.172Mi ± 0%     1.248Mi ± 0%  -42.56% (p=0.000 n=20)
LintRW/clickhouse    2.440Mi ± 0%     1.451Mi ± 0%  -40.52% (p=0.000 n=20)
LintRule/L007        92.98Ki ± 0%     92.98Ki ± 0%        ~ (p=1.000 n=20) ¹
LintRule/L010          0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=20) ¹
geomean                           ²                 -33.67%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                   │     base      │                 head                 │
                   │   allocs/op   │  allocs/op   vs base                 │
LintParallel/rules   68.93k ± 0%     68.93k ± 0%       ~ (p=0.835 n=20)
LintParallel/lint    126.7k ± 0%     117.6k ± 0%  -7.16% (p=0.000 n=20)
LintRW/postgresql    14.13k ± 0%     13.09k ± 0%  -7.33% (p=0.000 n=20)
LintRW/mysql         17.46k ± 0%     16.11k ± 0%  -7.73% (p=0.000 n=20)
LintRW/mariadb       15.76k ± 0%     14.53k ± 0%  -7.76% (p=0.000 n=20)
LintRW/sqlserver     13.87k ± 0%     12.98k ± 0%  -6.45% (p=0.000 n=20)
LintRW/oracle        16.86k ± 0%     15.71k ± 0%  -6.78% (p=0.000 n=20)
LintRW/sqlite        15.74k ± 0%     14.66k ± 0%  -6.86% (p=0.000 n=20)
LintRW/snowflake     15.20k ± 0%     14.16k ± 0%  -6.87% (p=0.000 n=20)
LintRW/clickhouse    17.66k ± 0%     16.34k ± 0%  -7.46% (p=0.000 n=20)
LintRule/L007        1.194k ± 0%     1.194k ± 0%       ~ (p=1.000 n=20) ¹
LintRule/L010         0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=20) ¹
geomean                          ²                -5.42%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                  │    base     │                head                │
                  │  sec/stmt   │  sec/stmt    vs base               │
LintRW/postgresql   9.198µ ± 1%   8.682µ ± 1%  -5.62% (p=0.000 n=20)
LintRW/mysql        7.595µ ± 1%   7.162µ ± 2%  -5.71% (p=0.000 n=20)
LintRW/mariadb      7.566µ ± 2%   7.054µ ± 2%  -6.77% (p=0.000 n=20)
LintRW/sqlserver    9.789µ ± 2%   9.216µ ± 2%  -5.86% (p=0.000 n=20)
LintRW/oracle       8.884µ ± 2%   8.465µ ± 0%  -4.72% (p=0.000 n=20)
LintRW/sqlite       7.702µ ± 2%   7.141µ ± 1%  -7.28% (p=0.000 n=20)
LintRW/snowflake    8.515µ ± 2%   7.958µ ± 3%  -6.54% (p=0.000 n=20)
LintRW/clickhouse   7.941µ ± 2%   7.462µ ± 1%  -6.03% (p=0.000 n=20)
LintRule/L007       612.4n ± 2%   603.6n ± 2%       ~ (p=0.358 n=20)
LintRule/L010       199.3n ± 4%   192.4n ± 5%       ~ (p=0.101 n=20)
geomean             4.432µ        4.194µ       -5.35%

pkg: github.com/ajitpratap0/GoSQLX/pkg/sql/keywords
                         │     base     │                head                │
                         │    sec/op    │   sec/op     vs base               │
DetectDialect/empty        1.411n ± 11%   1.388n ± 8%       ~ (p=0.878 n=20)
DetectDialect/generic      137.0n ±  2%   135.6n ± 4%       ~ (p=0.952 n=20)
DetectDialect/postgresql   172.6n ±  6%   171.6n ± 6%       ~ (p=0.774 n=20)
DetectDialect/mysql        152.7n ±  4%   152.9n ± 5%       ~ (p=0.973 n=20)
DetectDialect/sqlserver    170.8n ±  6%   172.1n ± 3%       ~ (p=0.841 n=20)
DetectDialect/oracle       163.7n ±  5%   163.0n ± 5%       ~ (p=0.963 n=20)
DetectDialect/snowflake    236.2n ±  4%   228.0n ± 6%       ~ (p=0.402 n=20)
DetectDialect/mariadb      131.2n ±  6%   131.8n ± 5%       ~ (p=0.995 n=20)
DetectDialect/mixed        199.1n ±  4%   197.2n ± 4%       ~ (p=0.931 n=20)
DetectDialect/large_64KB   269.2µ ±  3%   270.6µ ± 2%       ~ (p=0.512 n=20)
geomean                    217.4n         216.1n       -0.62%

                         │     base     │                head                 │
                         │     B/s      │     B/s       vs base               │
DetectDialect/generic      369.0Mi ± 2%   372.7Mi ± 4%       ~ (p=0.947 n=20)
DetectDialect/postgresql   370.2Mi ± 6%   372.4Mi ± 6%       ~ (p=0.779 n=20)
DetectDialect/mysql        362.4Mi ± 4%   361.8Mi ± 5%       ~ (p=0.947 n=20)
DetectDialect/sqlserver    363.0Mi ± 6%   360.3Mi ± 3%       ~ (p=0.841 n=20)
DetectDialect/oracle       355.4Mi ± 5%   356.9Mi ± 4%       ~ (p=0.968 n=20)
DetectDialect/snowflake    359.4Mi ± 3%   372.3Mi ± 6%       ~ (p=0.398 n=20)
DetectDialect/mariadb      341.5Mi ± 5%   340.2Mi ± 5%       ~ (p=0.995 n=20)
DetectDialect/mixed        354.5Mi ± 4%   357.8Mi ± 4%       ~ (p=0.947 n=20)
DetectDialect/large_64KB   232.4Mi ± 3%   231.3Mi ± 2%       ~ (p=0.512 n=20)
geomean                    342.3Mi        344.1Mi       +0.52%

                         │     base     │                head                 │
                         │     B/op     │    B/op     vs base                 │
DetectDialect/empty        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/generic      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/postgresql   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/mysql        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/sqlserver    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/oracle       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/snowflake    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/mariadb      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/mixed        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/large_64KB   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
geomean                               ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                         │     base     │                head                 │
                         │  allocs/op   │ allocs/op   vs base                 │
DetectDialect/empty        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/generic      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/postgresql   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/mysql        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/sqlserver    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/oracle       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/snowflake    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/mariadb      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/mixed        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
DetectDialect/large_64KB   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
geomean                               ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

pkg: github.com/ajitpratap0/GoSQLX/pkg/sql/tokenizer
                         │    base     │                head                │
                         │   sec/op    │   sec/op     vs base               │
Tokenize/scratch/join      783.1n ± 3%   769.5n ± 3%       ~ (p=0.211 n=20)
Tokenize/scratch/complex   2.072µ ± 3%   2.087µ ± 3%       ~ (p=0.836 n=20)
Tokenize/scratch/insert    388.9n ± 4%   378.1n ± 5%       ~ (p=0.231 n=20)
geomean                    857.7n        846.8n       -1.28%

                         │     base     │                head                 │
                         │     B/s      │     B/s       vs base               │
Tokenize/scratch/join      153.4Mi ± 3%   156.2Mi ± 3%       ~ (p=0.211 n=20)
Tokenize/scratch/complex   174.0Mi ± 3%   172.7Mi ± 3%       ~ (p=0.846 n=20)
Tokenize/scratch/insert    186.4Mi ± 5%   191.7Mi ± 6%       ~ (p=0.231 n=20)
geomean                    170.7Mi        172.9Mi       +1.29%

                         │     base     │                head                 │
                         │     B/op     │    B/op     vs base                 │
Tokenize/scratch/join      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
Tokenize/scratch/complex   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
Tokenize/scratch/insert    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
geomean                               ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                         │     base     │                head                 │
                         │  allocs/op   │ allocs/op   vs base                 │
Tokenize/scratch/join      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
Tokenize/scratch/complex   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
Tokenize/scratch/insert    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
geomean                               ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

pkg: github.com/ajitpratap0/GoSQLX/pkg/transform
                             │    base     │                head                │
                             │   sec/op    │   sec/op     vs base               │
TransformParse/simple_select   833.7n ± 2%   824.3n ± 1%       ~ (p=0.414 n=20)
TransformParse/join            2.884µ ± 5%   2.860µ ± 3%       ~ (p=0.683 n=20)
TransformParse/complex         7.149µ ± 3%   7.018µ ± 3%       ~ (p=0.298 n=20)
geomean                        2.581µ        2.548µ       -1.26%

                             │     base     │                 head                  │
                             │     B/op     │     B/op      vs base                 │
TransformParse/simple_select     704.0 ± 0%     704.0 ± 0%       ~ (p=1.000 n=20) ¹
TransformParse/join            1.789Ki ± 0%   1.789Ki ± 0%       ~ (p=1.000 n=20) ¹
TransformParse/complex         4.883Ki ± 0%   4.883Ki ± 0%       ~ (p=1.000 n=20) ¹
geomean                        1.818Ki        1.818Ki       +0.00%
¹ all samples are equal

                             │    base    │                head                 │
                             │ allocs/op  │ allocs/op   vs base                 │
TransformParse/simple_select   3.000 ± 0%   3.000 ± 0%       ~ (p=1.000 n=20) ¹
TransformParse/join            15.00 ± 0%   15.00 ± 0%       ~ (p=1.000 n=20) ¹
TransformParse/complex         43.00 ± 0%   43.00 ± 0%       ~ (p=1.000 n=20) ¹
geomean                        12.46        12.46       +0.00%
¹ all samples are equal

pkg: github.com/ajitpratap0/GoSQLX/wasm/internal/bridge
                        │    base     │                head                │
                        │   sec/op    │   sec/op     vs base               │
WASMBridge/parse/small    2.743µ ± 2%   2.708µ ± 2%       ~ (p=0.110 n=20)
WASMBridge/parse/medium   11.72µ ± 2%   11.43µ ± 3%       ~ (p=0.245 n=20)
WASMBridge/parse/large    98.82µ ± 2%   99.09µ ± 3%       ~ (p=0.738 n=20)
WASMBridge/lint/small     3.780µ ± 2%   3.623µ ± 2%  -4.14% (p=0.000 n=20)
WASMBridge/lint/medium    15.16µ ± 3%   13.96µ ± 1%  -7.91% (p=0.000 n=20)
WASMBridge/lint/large     91.03µ ± 1%   87.11µ ± 3%  -4.30% (p=0.000 n=20)
geomean                   15.97µ        15.43µ       -3.35%

                        │     base     │                 head                 │
                        │     B/s      │      B/s       vs base               │
WASMBridge/parse/small    13.56Mi ± 2%    13.74Mi ± 2%       ~ (p=0.119 n=20)
WASMBridge/parse/medium   21.23Mi ± 3%    21.78Mi ± 3%       ~ (p=0.239 n=20)
WASMBridge/parse/large    11.33Mi ± 2%    11.30Mi ± 3%       ~ (p=0.773 n=20)
WASMBridge/lint/small     9.837Mi ± 2%   10.266Mi ± 2%  +4.36% (p=0.000 n=20)
WASMBridge/lint/medium    16.42Mi ± 3%    17.83Mi ± 1%  +8.63% (p=0.000 n=20)
WASMBridge/lint/large     12.30Mi ± 1%    12.85Mi ± 4%  +4.50% (p=0.000 n=20)
geomean                   13.65Mi         14.13Mi       +3.47%

                        │     base      │                  head                  │
                        │     B/op      │     B/op      vs base                  │
WASMBridge/parse/small     1.531Ki ± 0%   1.531Ki ± 0%        ~ (p=1.000 n=20) ¹
WASMBridge/parse/medium    5.961Ki ± 0%   5.961Ki ± 0%        ~ (p=1.000 n=20) ¹
WASMBridge/parse/large     74.97Ki ± 0%   74.97Ki ± 0%        ~ (p=1.000 n=20) ¹
WASMBridge/lint/small      4.492Ki ± 0%   2.773Ki ± 0%  -38.26% (p=0.000 n=20)
WASMBridge/lint/medium    16.023Ki ± 0%   7.648Ki ± 0%  -52.27% (p=0.000 n=20)
WASMBridge/lint/large     123.53Ki ± 0%   73.27Ki ± 0%  -40.68% (p=0.000 n=20)
geomean                    13.51Ki        10.10Ki       -25.22%
¹ all samples are equal

                        │    base     │                 head                 │
                        │  allocs/op  │  allocs/op   vs base                 │
WASMBridge/parse/small     8.000 ± 0%    8.000 ± 0%       ~ (p=1.000 n=20) ¹
WASMBridge/parse/medium    38.00 ± 0%    38.00 ± 0%       ~ (p=1.000 n=20) ¹
WASMBridge/parse/large     522.0 ± 0%    522.0 ± 0%       ~ (p=1.000 n=20) ¹
WASMBridge/lint/small      33.00 ± 0%    30.00 ± 0%  -9.09% (p=0.000 n=20)
WASMBridge/lint/medium    100.00 ± 0%    97.00 ± 0%  -3.00% (p=0.000 n=20)
WASMBridge/lint/large     1.031k ± 0%   1.026k ± 0%  -0.48% (p=0.000 n=20)
geomean                    90.24         88.29       -2.15%
¹ all samples are equal

                        │    base     │                 head                 │
                        │   outB/op   │   outB/op    vs base                 │
WASMBridge/parse/small     635.0 ± 0%    635.0 ± 0%       ~ (p=1.000 n=20) ¹
WASMBridge/parse/medium   2.661k ± 0%   2.661k ± 0%       ~ (p=1.000 n=20) ¹
WASMBridge/parse/large    33.16k ± 0%   33.16k ± 0%       ~ (p=1.000 n=20) ¹
WASMBridge/lint/small      22.00 ± 0%    22.00 ± 0%       ~ (p=1.000 n=20) ¹
WASMBridge/lint/medium     293.0 ± 0%    293.0 ± 0%       ~ (p=1.000 n=20) ¹
WASMBridge/lint/large      294.0 ± 0%    294.0 ± 0%       ~ (p=1.000 n=20) ¹
geomean                    688.2         688.2       +0.00%
¹ all samples are equal

Run, raw data and benchstat

…nce changelog fragment [W6-06cd]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 24s —— View job


Review of PR #962

I read the diff for linter.go, context.go, tokscratch.go and the pool tests. I didn't run the tests or benchmarks. The perf numbers below come from the gate comment.

Verdict: no blocking issues.

Correctness

  • Release order. ReleaseAST is deferred after PutParser and PutTokenizer. Defers run last-in-first-out, so the tree is released first, then the parser, then the tokenizer scratch. The tree can reference Word values owned by the scratch, so this order matters.
  • Error and panic paths. The defer is function-scoped, so it runs on a rule error and on a panic in Check. Returned violations and syntax errors are values, so they stay valid. Token strings are substrings of the input.
  • Nil guard. The astObj != nil guard is correct. ReleaseAST(nil) is also a no-op, so the unconditional call in freshLint is fine.

Performance

The perf gate passed, and the target was met.

  • LintRW B/op is down 40–45% across all 8 dialects, against a threshold of ≤ -15%.
  • LintRW time is down 6–13%, and allocs/op are down 6–7%.
  • Parse, Tokenize and Normalize rows are neutral, and B/op is +0.00%.
  • The A/A' control was clean, with 0 of 52 benchmarks moved.
  • The low-power rows (LintRule/L010, ParseRW/clickhouse) can't be resolved by the gate on their own, but their allocs/op and instructions/op are unchanged.

Suggestions (non-blocking)

  1. Silent breakage for third-party rules. A rule that retains the AST, a node or a *Word will read recycled memory without any error. The docs on Rule, Context and Nodes() cover the contract well. A race-build mode that poisons released nodes would make retention bugs show up in rule authors' own tests. If you decide not to add one, say so in the Rule.Check doc.
  2. freshLint in linter_pool_test.go:70. defer ast.ReleaseAST(tree) sits inside a loop that breaks after one iteration. It works, but it reads oddly. Release the tree explicitly after the loop, or move the parse out of it.
  3. Doc wording.
    • In the Context doc, write Nodes() as a method: "AST, Tokens and Nodes() results".
    • The tokscratch sentence "must not return the slice as an owned result" is vague. Something like "must not hand the slice to a caller that outlives the next tokenize call" is clearer.
  4. Fix audit. The PR says the in-repo rules were audited for retained references. Please also confirm that no in-repo Fix implementation relies on a saved Context or AST. The breaking-changes fragment already tells authors to use the SQL argument.

Tests

Coverage is good:

  • Lifetime tests with race-on and race-off variants.
  • New edge inputs: multi-statement input with an error, unterminated strings, non-ASCII identifiers.
  • A concurrent lifetimeSummary rule.
  • fingerprint.Normalize added to the concurrent pool mix.

The fix to TestLintPoolContamination and the concurrent test, which now release parsed trees, is correct. Without it those tests would leak trees from the pool.
· Branch: perf/w6-06cd-lint-release-ast

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 17s —— View job


Review of PR #962 (latest sync)

I read the diff for linter.go, context.go, tokscratch.go and the pool tests. I didn't run the tests or benchmarks. The perf numbers come from the gate comment.

Verdict: no blocking issues.

Correctness

  • Release order. defer ast.ReleaseAST(astObj) is registered after the PutTokenizer and PutParser defers, so it runs first. The tree is released before the parser and the tokenizer scratch it may reference.
  • Scope. The defer sits inside if hasStatementTokens, but defers are function-scoped. The release happens when LintString returns, after every rule set has run. It also happens on a rule error or a panic.
  • Nil and partial trees. The astObj != nil guard covers failed parses. ReleaseAST(nil) is a no-op, so the unconditional calls in the tests are fine.
  • Returned data. Violations, ParseError and TokenizeError are returned by value. Token strings are substrings of the input, so they stay valid.

Performance

The gate passed and the target was met.

  • LintRW B/op is down 39.9% to 44.7% (target ≤ -15%).
  • LintRW time is down 3.5% to 7.5%, and allocs/op are down 6% to 7%.
  • Parse, Tokenize and Normalize rows are neutral.
  • The A/A' control was clean (0 of 52 moved).
  • Several LintRW rows are low power on time. The deterministic B/op and allocs/op columns back up those gains.

Suggestions (non-blocking)

  1. Silent breakage for third-party rules. A rule that retains the AST, a node or a *Word will read recycled memory with no error. The docs on Rule.Check, Context and Nodes() describe the contract well. A race-build mode that poisons released nodes would make retention bugs fail deterministically in rule authors' tests. If you don't want that, say so in the Rule.Check doc.
  2. freshLint (linter_pool_test.go:70). defer ast.ReleaseAST(tree) sits in a loop that breaks after one iteration. It works, but it reads oddly. Release the tree explicitly after the loop, or move the parse out of it.
  3. Doc wording.
    • tokscratch.go: "must not return the slice as an owned result" is vague. Try "must not hand the slice to a caller that outlives the next tokenize call".
    • context.go: write "AST, Tokens and Nodes() results" so Nodes() reads as a method.
  4. Fix audit. The retention audit table says Fix works from its SQL argument. Please also confirm explicitly that no in-repo Fix implementation uses a saved Context. The audit table suggests none does.

Tests

Coverage is good:

  • Lifetime tests with race-on and race-off variants.
  • New edge inputs: multi-statement input with an error, unterminated strings, non-ASCII identifiers.
  • A concurrent summary rule.
  • fingerprint.Normalize added to the concurrent pool mix.
  • TestLintPoolContamination and the concurrent test now release their parsed trees. That keeps the pools balanced.
    · Branch: perf/w6-06cd-lint-release-ast

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 17s —— View job


Review of PR #962 (latest sync)

I read the diff for linter.go, rule.go, context.go, tokscratch.go and the pool tests. I didn't run the tests or benchmarks. The perf numbers come from the gate comment.

Verdict: no blocking issues.

Correctness

  • Release order. defer ast.ReleaseAST(astObj) is registered after the PutTokenizer and PutParser defers, so it runs first. The tree is released before the parser and the tokenizer scratch it may reference.
  • Scope. The defer sits inside if hasStatementTokens, but defers are function-scoped. The release happens when LintString returns, after every rule set has run. It also happens on a rule error or a panic.
  • Nil and partial trees. The astObj != nil guard covers failed parses. ReleaseAST(nil) is a no-op, so the unconditional calls in the tests are fine.
  • Returned data. Violations, ParseError and TokenizeError are returned by value. Token strings are substrings of the input, so they stay valid.

Performance

The gate passed and the target was met.

  • LintRW B/op is down 39.9% to 44.8% (target ≤ -15%).
  • LintRW time is down 5% to 8%, and allocs/op are down 6% to 7%.
  • Parse, Tokenize and Normalize rows are neutral.
  • The A/A' control was clean (0 of 52 flagged).

Suggestions (non-blocking)

  1. Silent breakage for third-party rules. A rule that retains the AST, a node or a *Word will read recycled memory with no error. The docs on Rule.Check, Context and Nodes() describe the contract well. A race-build mode that poisons released nodes would make retention bugs fail deterministically in rule authors' tests. If you don't want that, say so in the Rule.Check doc.
  2. freshLint (linter_pool_test.go:70). defer ast.ReleaseAST(tree) sits in a loop that breaks after one iteration. It works, but it reads oddly. Release the tree explicitly after the loop, or move the parse out of it.
  3. Doc wording.
    • tokscratch.go: "must not return the slice as an owned result" is vague. Try "must not hand the slice to a caller that outlives the next tokenize call".
    • context.go: write "AST, Tokens and Nodes() results" so Nodes() reads as a method.
  4. Fix audit. The retention audit table says Fix works from its SQL argument. Please also confirm explicitly that no in-repo Fix implementation uses a saved Context.

Tests

Coverage is good:

  • Lifetime tests with race-on and race-off variants.
  • New edge inputs: multi-statement input with an error, unterminated strings, non-ASCII identifiers.
  • A concurrent summary rule, and fingerprint.Normalize in the concurrent pool mix.
  • TestLintPoolContamination and the concurrent test now release their parsed trees, which keeps the pools balanced.
    · Branch: perf/w6-06cd-lint-release-ast

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 15s —— View job


Review of PR #962 (latest sync)

I read the diff for linter.go, rule.go, context.go, tokscratch.go and the pool tests. I didn't run the tests or benchmarks. The perf numbers come from the gate comment.

Verdict: no blocking issues.

Correctness

  • Release order. defer ast.ReleaseAST(astObj) is registered after the PutTokenizer and PutParser defers, so it runs first. The tree is released before the parser and the tokenizer scratch it may reference.
  • Scope. The defer sits inside if hasStatementTokens, but defers are function-scoped. The release happens when LintString returns, after every rule set has run. It also happens on a rule error or a panic.
  • Nil and partial trees. The astObj != nil guard covers failed parses. ReleaseAST(nil) is a no-op, so the unconditional calls in the tests are fine.
  • Returned data. Violations, ParseError and TokenizeError are returned by value. Token strings are substrings of the input, so they stay valid.

Performance

The gate passed and the target was met.

  • LintRW B/op is down about 40–45% (target ≤ -15%).
  • LintRW time is down about 5–8%, and allocs/op are down about 6–7%.
  • Parse, Tokenize and Normalize rows are neutral.
  • The A/A' control was clean (0 of 52 flagged on the last run).

Suggestions (non-blocking)

  1. Silent breakage for third-party rules. A rule that retains the AST, a node or a *Word will read recycled memory with no error. The docs on Rule.Check, Context and Nodes() describe the contract well. A race-build mode that poisons released nodes would make retention bugs fail deterministically in rule authors' tests. If you don't want that, say so in the Rule.Check doc.
  2. freshLint (linter_pool_test.go:70). defer ast.ReleaseAST(tree) sits in a loop that breaks after one iteration. It works, but it reads oddly. Release the tree explicitly after the loop, or move the parse out of it.
  3. Doc wording.
    • tokscratch.go: "must not return the slice as an owned result" is vague. Try "must not hand the slice to a caller that outlives the next tokenize call".
    • context.go: write "AST, Tokens and Nodes() results" so Nodes() reads as a method.
  4. Fix audit. The retention audit table says Fix works from its SQL argument. Please also confirm explicitly that no in-repo Fix implementation uses a saved Context.

Tests

Coverage is good:

  • Lifetime tests with race-on and race-off variants.
  • New edge inputs: multi-statement input with an error, unterminated strings, non-ASCII identifiers.
  • A concurrent summary rule, and fingerprint.Normalize in the concurrent pool mix.
  • TestLintPoolContamination and the concurrent test now release their parsed trees, which keeps the pools balanced.
    · Branch: perf/w6-06cd-lint-release-ast

@ajitpratap0
ajitpratap0 merged commit 21ffc4d into main Nov 15, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant