Repository navigation
perf(security): pooled struct visitor for Scanner.Scan [W6-02] - #938
ajitpratap0 wants to merge 5 commits into
Conversation
Replace the per-call ast.Inspect closure and heap-escaping ancestors slice with a pooled scanWalker. Findings are byte-identical (frozen-reference differential test). BenchmarkScanASTRW B/op -53% to -58%, allocs/op -29% to -33% on M4 (indicative). 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 38s —— View job Review of PR #938: pooled struct visitor for
|
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.03%, p 0.820. Low power6 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) |
…[W6-02] The race shard exceeded its 2m budget; use fewer workers/iterations and a 100-term chain under -race (full 5000-deep run stays in the non-race run). 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 #938: pooled struct visitor for
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
Claude finished @ajitpratap0's task in 23s —— View job Review of PR #938: pooled struct visitor for
|
|
Claude finished @ajitpratap0's task in 26s —— View job Review of PR #938: pooled struct visitor for
|
Summary
W6-02 (SEC-2):
Scanner.Scanwalks the AST with a pooled structast.Visitor(scanWalker) instead of a per-call closure and heap-escaping ancestors slice. Popped slots are nil-ed and walkers deeper than 1024 are not pooled (fixes a bug in the audit prototype). No API or behaviour change; findings are byte-identical.Test Plan
go test -count=1 ./pkg/sql/security/...and-race: pass (goldensecurity.sha256unchanged).task test:cbinding,go test ./pkg/compatibility/..., staticcheck on pkg/sql/security: pass.task check: onlypkg/transpilerTestTranspileDeepChainLinear failed (timing-ratio test, load average ~97 on the shared M4; the package does not import pkg/sql/security).task bench:ab(indicative, load 7-12+): BenchmarkScanASTRW B/op -53.3% to -58.3% per dialect, allocs/op -29% to -33%; ComplexQuery/LargeQuery/Parallel B/op -14% to -36%, allocs -19% to -43%. Time not significant (noise).go test -race ./pkg/sql/securitynow 18.7s locally (was 25-32s). Timeout not changed. Branch merged with origin/main (ci(perf): randomize code layout in the A/B perf gate so layout noise cannot read as a regression #934 gate now in).Breaking Changes
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2