Skip to content

[4.2-dev] pSpool cached batch reuse is 5–7% slower than v4.2.8 in controlled AB/BA benchmark #32761

Closed

Description

@XuPeng-SH

Summary

On the 4.2-dev snapshot below, the existing BenchmarkCachedBatchReuse is consistently slower than on v4.2.8 in two controlled AB/BA microbenchmark rounds. The regression reproduced with identical benchmark source, identical host/toolchain, -cpu=1, and unchanged memory allocation (240 B/op, 3 allocs/op).

This is a reproducible pSpool microbenchmark regression, not a claim about end-to-end SQL latency or an SLO violation.

Versions and environment

  • Baseline A: 10d204b8763f19b2b37ba2147d1d4c1a7828d6d4 (v4.2.8)
  • Target B: ad39691b6b45f26688d42c47d9451bc89c957679 (origin/4.2-dev snapshot)
  • Host: macOS arm64
  • Go toolchain: go1.26.4 darwin-arm64
  • pkg/container/pSpool/copy_benchmark_test.go is byte-identical between A and B (git diff --exit-code ... -- <file> returned 0).
  • Each round used fresh test processes in AB/BA order: A1, B1, B2, A2.

Results

Round Samples per version A median B median B vs A Bootstrap 95% CI for B/A median
Initial (-benchtime=300ms -count=8) 16 732.05 ns/op 769.25 ns/op +5.08% [1.0278, 1.0996]
Confirmation (-benchtime=100000x -count=12) 24 749.80 ns/op 802.00 ns/op +6.96% [1.0290, 1.1176]

Confirmation-round same-version median drift was small: A1→A2 -1.70%, B1→B2 +1.75%.

Confirmation-round run-level distribution (not query latency percentiles):

Version p95 run ns/op p99 run ns/op Median throughput
A 807.18 812.18 1,333,689 ops/s
B 883.29 920.51 1,246,883 ops/s

Both rounds reported 240 B/op and 3 allocs/op for both versions, so the observed delta is CPU/time rather than an allocation-count regression in this benchmark.

Reproduction

Run in each worktree using the repository CGo test wrapper:

.agents/skills/mo-dev/scripts/mo-cgo-test \
  -run '^$' \
  -bench '^BenchmarkCachedBatchReuse$' \
  -benchmem \
  -benchtime=100000x \
  -count=12 \
  -cpu=1 \
  -timeout=120s \
  ./pkg/container/pSpool

Repeat in AB/BA order (A1 B1 B2 A2) rather than inferring performance from one run.

Request

Please investigate the source of the 4.2-dev slowdown and determine whether the cached-batch reuse path can retain its correctness fixes without this measurable time regression.

Evidence retained

Local QA evidence under /Users/xupeng/qa_plan/evidence/performance/:

  • pspool-{A1,B1,B2,A2}.log
  • pspool-confirm-{A1,B1,B2,A2}.log
  • pspool-confirm-metadata.json
  • analysis.json, analysis-summary.log, analyze.py

Activity

  1. self-assigned this
    on Nov 15, 2026
  2. XuPeng-SH commented on Nov 19, 2026

    @XuPeng-SH
    ContributorAuthor

    not repro

  3. XuPeng-SH commented on Nov 19, 2026

    @XuPeng-SH
    ContributorAuthor

    Closure evidence for "not repro": re-ran the exact benchmark from this issue on the same host in AB/BA order.

    • Source: pkg/container/pSpool/copy_benchmark_test.go is byte-identical between v4.2.8 (10d204b) and current 4.2-dev (71e2233) — git diff --exit-code returns 0.
    • Command: repository CGo wrapper, -bench ^BenchmarkCachedBatchReuse$ -benchtime=100000x -count=12 -cpu=1 -benchmem, fresh process per round, order A1 (v4.2.8), B1 (4.2-dev), B2 (4.2-dev), A2 (v4.2.8); 24 samples per version.
    • Result: v4.2.8 combined median 1028.5 ns/op vs 4.2-dev 1020.5 ns/op (B/A = 0.992, i.e. -0.78%). Allocation profile unchanged on both sides: 240 B/op, 3 allocs/op.
    • Same-version drift across rounds is of the same magnitude (A1 -> A2: -1.31%; B1 -> B2: +0.10%), so the residual cross-version delta is within run-to-run noise. The regression was most plausibly removed by the later pSpool cache-assignment rework (fix(pSpool): reserve cached backing across batch columns on 4.2-dev #32753 / fix(pSpool): preserve batch reuse without planning slices on 4.2-dev #32758, merged as 85f2eba / 296402f).

    Boundary note: this rerun is linux/amd64 (Ryzen 9 7900X, Go 1.27.1), not the original macOS arm64 host. Reopen if a controlled macOS arm64 AB/BA round shows the regression again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions