Repository navigation
test(bench): lint, security and LSP benchmark matrix [W0-06] - #910
Conversation
Adds the PLAN.md 2.2 benchmarks for the linter (LintRW, LintPhase, LintRule L001-L030), the security scanner (ScanSQLRW, ScanSQLParams, ScanSQLLarge, ScanASTRW) and the LSP handler (semanticTokens, documentSymbol, diagnostics, editCycle, didChangeIncremental at 1KB/30KB/300KB for postgresql, mysql, sqlserver), all fed from internal/benchcorpus. Behaviour tests pin that the inputs are valid, deterministic and exercise the code they claim to. 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 31s —— View job Review of PR #910: lint, security and LSP benchmark matrixThis is a test-only PR, and the structure is good. The Bug (medium)
Fix: release the trees once, after the synchronous trees := parseTrees(b, rwSQL(b, d), d)
b.Run(d, func(b *testing.B) { ... })
for _, t := range trees { ast.ReleaseAST(t) }Alternatively, parse inside the closure before Smaller issues
Positives
The |
…n LSP checks [W0-06] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
Reset a per-input scratch Context by value instead of heap-copying one per Check, share one Context per statement across all rules in LintPhase/rules, and add an alloc guard so harness overhead cannot return. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
Claude finished @ajitpratap0's task in 11s —— View job Re-review of PR #910 after the latest commitsThe medium bug from my earlier review is fixed in the current head. I read
Nothing blocking from my side. |
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
editCycle now runs didChange, validateDocument, documentSymbol and semanticTokens (3 tokenizations, 2 parses), the workload W6-12's per-document cache targets. TestLSPBenchOps runs the shared cycle body and checks symbols and tokens are non-empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
Claude finished @ajitpratap0's task in 13s —— View job Re-review of PR #910 (latest head
|
Per-op json.Marshal was ~26% of didChangeIncremental/1KB time and 4 of its 13 allocs/op. Build the insert/delete pair once in lspBenchHandler and share the edit closure between BenchmarkLSP and TestLSPBenchOps. 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 Re-review of PR #910 (head
|
Perf gate: PASS (shadow mode: report only, this check never fails)Base
Rules: time regresses at >= +3% with p < 0.01 (Mann-Whitney U), or a suite geomean >= +1.5% (per-round 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%. An A/A control with more than 10% of benchmarks moving over 3% is noisy: re-run once, then inconclusive (neutral). Gated suite (GOGC=off, GOMAXPROCS=1)
A/A control: 0 of 26 benchmarks moved more than 3%. Instructions per operation (cmd/perfdriver)
Secondary metric: default GC, GOMAXPROCS=1 (informational)
Environmentbenchstat (primary metric) |
|
Claude finished @ajitpratap0's task in 16s —— View job Re-review of PR #910 (head
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
…0-12] (#917) * feat(bench): per-arch baselines, matrix/pgo tasks, methodology doc [W0-12] Add benchmarks/baselines/{amd64,arm64}.json (ns/op trend-only, B/op and allocs/op gated) with a scripts/perf/baseline checker and -update flag, task bench:matrix, bench:baseline, bench:baseline:update and pgo:refresh, docs/PERFORMANCE_METHODOLOGY.md, and one consolidated wave-0 CHANGELOG entry. performance_baselines.json and TestPerformanceRegression are documented as a smoke test only; its two never-enforced entries are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2 * fix(bench): fail stale/disjoint baselines, check provenance, pipefail matrix, doc fixes [W0-12] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2 * fix(bench): external baseline provenance, go1.26 re-record, local-only docs [W0-12] -update -input now requires -go-version and records external provenance instead of stamping the local toolchain. Re-record arm64.json with go1.26.9, drop the stale tolerance advice from PERFORMANCE_TUNING, and state that bench:baseline is local until W0-13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2 * docs(perf): describe the gate's secondary arm accurately; cite #917 in CHANGELOG Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2 * docs(changelog): list #910 and #914 in the wave-0 entry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Test-only. Adds the PLAN.md 2.2 benchmark rows for lint, security and LSP, all fed from
internal/benchcorpus(W0-01).pkg/linter/bench_matrix_test.go:BenchmarkLintRW/<dialect>(8 dialects),BenchmarkLintPhase/{tokenize,parse,rules}/<dialect>,BenchmarkLintRule/L001..L030.pkg/sql/security/bench_matrix_test.go:BenchmarkScanSQLRW/<dialect>,BenchmarkScanSQLParams/{pg_dollar,qmark,at},BenchmarkScanSQLLarge/{30KB,1MB},BenchmarkScanASTRW/<dialect>.pkg/lsp/bench_matrix_test.go:BenchmarkLSP/{semanticTokens,documentSymbol,diagnostics,editCycle,didChangeIncremental}/{1KB,30KB,300KB}/{postgresql,mysql,sqlserver}.Notes on shape:
_testpackages becausebenchcorpusimportspkg/gosqlx, which imports both.ns/stmtis reported.benchcorpus.Script; the didChange benchmarks cancel the 300 ms debounce timer so no validation runs in the background.editCycle= didChange + validateDocument + documentSymbol + semanticTokens (3 tokenizations, 2 parses).Test Plan
task check(fmt, vet, golangci-lint 0 issues,go test -raceover all non-cbinding packages): pass. A first run during a full-disk episode on the shared machine failed with no package named; the identicalCGO_ENABLED=1 go test -race -timeout 120s $(go list ./... | grep -v /cbinding)re-run passed.task test:cbinding: passgo test -count=1 ./pkg/compatibility/...: passgo run honnef.co/go/tools/cmd/staticcheck@latest ./pkg/linter/ ./pkg/sql/security/ ./pkg/lsp/: clean-race -benchtime 1x(1MB scan excluded for time).-benchtime 1x/3x, not A/B data): LintRW ~22-30 us/stmt; ScanSQLLarge/1MB ~1.6 s/op; LSP documentSymbol 30KB 5-7 ms vs 300KB 230-385 ms.Review fixes (c3b9f69)
editCyclenow also runs documentSymbol (didChange + validateDocument + documentSymbol + semanticTokens);lspEditCycleis shared withTestLSPBenchOps, so the test pins the same sequence.editCycle/1KB/postgresqlis 487 allocs/op.lspBenchHandler, outside the timed loop (lspBenchEditshared by the benchmark and the test). Before, per-opjson.Marshalwas about 26% ofdidChangeIncremental/1KBtime and 4 of its 13 allocs/op; nowdidChangeIncremental/1KB/postgresqlis 1568 ns/op, 2704 B/op, 9 allocs/op (M4, GOGC=off, -cpu 1, 20000x).Review fixes (d80003f)
*scratch = *proto) per Check, so the harness allocates nothing; TestLintContextHasNoCachedState pins the Context field set so W6-05 must updatelintInput.reset.Review fixes (3021a5e)
BenchmarkLintRule/L001now reports 0 B/op, 0 allocs/op; L015 256 B/op, 2 allocs/op over the whole loop (was ~315 KB, ~2813 allocs).LintPhase/rules/<dialect>resets one Context per statement and shares it across all 30 rules, likeLinter.LintString(postgresql: 61398 -> 52249 allocs/op), so a W6-05 cachedContext.Nodes()is measured as in production.TestBenchContextResetIsAllocFree: reset and reset+Check of L001/L015 on a violation-free input must allocate 0.Breaking Changes
None. Test files only.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2