Repository navigation
test(bench): high-level, render and transform benchmark matrix [W0-05] - #911
Conversation
Add the section 2.2 benchmarks for Normalize/Fingerprint (per portable query and NormalizeScale), Render (compact, readable, lower, sql), RenderRW (nodialect vs dialect), RenderScale, FormatWithDialectRW, ValidateRW (small/medium/large per dialect), TransformParse, TransformRoundTrip (generic and SQL Server), Highlight and DetectDialect. Inputs come from internal/benchcorpus; a new ScaleSQL generator is shared by the scale benchmarks. Each benchmark input set is guarded by a behaviour test. 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 17s —— View job Review of PR #911: benchmark matrix [W0-05]This was a light review. I read Overall: The PR looks good. It only adds test files and What I liked
Minor suggestions (non-blocking)
No bugs, security concerns or race issues found in the parts I read. |
- transform: time a pure roundTripOnce in the benchmark loops so tb.Helper is not part of the measurement; keep the TB wrapper for tests. - formatter: release the BenchmarkRenderRW trees with b.Cleanup. - formatter: build RenderRW options in renderRWOpts and add a test that the dialect variant does more work than nodialect (fails if Dialect is unset). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
…[W0-05] Replace the AllocsPerRun inequality with option-wiring and behavioural checks (OFFSET/FETCH vs LIMIT) so W5-11 optimizations do not break it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
|
Claude finished @ajitpratap0's task in 15s —— View job Review of PR #911: benchmark matrix [W0-05]I read Overall: This is a good PR. It changes only test files and the What works well
Suggestions (non-blocking)
|
Summary
Adds the W0-05 benchmark matrix from PLAN.md section 2.2, test files only, no production code changes.
pkg/fingerprint:BenchmarkNormalize/<q>,BenchmarkFingerprint/<q>over the 11 portable queries;BenchmarkNormalizeScale/{in,values}/{10,100,1000}.pkg/formatter:BenchmarkRender/{compact,readable,lower,sql}/<q>,BenchmarkRenderRW/<dialect>/{nodialect,dialect},BenchmarkRenderScale/{wide,in,values,and}/{10,100,1000}.pkg/gosqlx:BenchmarkFormatWithDialectRW/<dialect>,BenchmarkValidateRW/<dialect>/{small,medium,large},BenchmarkHighlight/<q>.pkg/transform:BenchmarkTransformParse/<q>,BenchmarkTransformRoundTrip/{addwhere,addwhere_fromsql,limit,rename}plus aBenchmarkTransformRoundTripSQLServersibling for the mssql column.pkg/sql/keywords:BenchmarkDetectDialect/<case>(8 detection routes plus a 64 KB script).internal/benchcorpus/scale.go: shared deterministicScaleSQL(shape, n)generator.Inputs come from
internal/benchcorpus(W0-01). Statements are filtered once outside the timer so loops never time an error path. Each input set has a behaviour test (rendered styles differ and keep identifiers, compact equalsSQL(), SQL Server limit renders as OFFSET/FETCH, buckets are sized correctly, spans are ordered and in bounds, detection results are pinned, fingerprints ignore literals).Notes: the old no-subbenchmark
BenchmarkNormalize/BenchmarkFingerprint(one join query) are replaced by the per-query sub-benchmarks, so their old names have no baseline.RenderScalewas re-measured (default benchtime, andGOGC=off -cpu 1at 10x/100x): wide/10, /100, /1000 are about 1.4, 12 and 110 us, linear at roughly 10x per step, so no super-linearity.Test Plan
task check: exit 0 (fmt, vet, golangci-lint 0 issues, race tests).task test:cbinding: exit 0.go test -count=1 ./pkg/compatibility/...: exit 0.go run honnef.co/go/tools/cmd/staticcheck@latest ./internal/benchcorpus ./pkg/fingerprint ./pkg/formatter ./pkg/transform ./pkg/gosqlx ./pkg/sql/keywords: exit 0.go test -run '^$' -bench <new benchmarks> -benchtime 10x/20x/50xin each package: all run and pass.Review fixes: transform round-trip benchmarks time a pure
roundTripOnce(notb.Helperin the loop);BenchmarkRenderRWreleases its trees viab.Cleanup;renderRWOptsis shared andTestRenderRWDialectPathDiffersfails if the dialect variant does no extra work (verified by mutation).Merge ordering: #903/#904 add same-named
BenchmarkTransformParse/BenchmarkRenderin-package; whichever lands after this PR must delete its copy and use these. W0-03 must not redefinerwDialects/rwValid.Breaking Changes
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2