Skip to content

fix(benchmarks): restore SQLite performance gate#640

Draft
cofin wants to merge 13 commits into
mainfrom
agent/codebase-c8-hotpath
Draft

fix(benchmarks): restore SQLite performance gate#640
cofin wants to merge 13 commits into
mainfrom
agent/codebase-c8-hotpath

Conversation

@cofin

@cofin cofin commented Jul 11, 2026

Copy link
Copy Markdown
Member

Summary

  • update the SQLite benchmark scenarios to use the current SqliteConfig(connection_config=...) API
  • restore actual SQLSpec measurements in make bench-gate; before this fix, all SQLSpec SQLite scenarios errored during setup
  • leave production hot paths unchanged after cumulative measurements rejected the proposed micro-optimizations

Benchmark result

The restored command runs successfully through measurement but exits nonzero because three existing thresholds fail:

Scenario Raw SQLSpec Overhead Threshold Result
iterative inserts 0.0176s 0.0933s 430.2% 100% fail
repeated queries 8.2965s 8.5146s 2.6% 5% pass
write-heavy 0.0146s 0.0199s 35.8% 10% fail
read-heavy 0.0186s 0.0239s 28.1% 12% fail

Cumulative optimization review

Each row is a full make bench-gate run at the cumulative commit. Cells show raw / SQLSpec (adjacent SQLSpec delta).

Proposed slice Iterative inserts Repeated queries Write-heavy Read-heavy Decision
harness-fixed baseline 0.0176 / 0.0933 8.2965 / 8.5146 0.0146 / 0.0199 0.0186 / 0.0239 baseline
cached driver execution 0.0260 / 0.0928 (-0.0005) 8.3654 / 8.5775 (+0.0629) 0.0147 / 0.0179 (-0.0020) 0.0183 / 0.0223 (-0.0016) rejected: expected repeated-query path regressed; other movement was not attributable
parameter processing 0.0171 / 0.0945 (+0.0017) 8.3245 / 8.5741 (-0.0034) 0.0143 / 0.0183 (+0.0004) 0.0176 / 0.0227 (+0.0004) rejected: expected improvement was noise and other scenarios regressed
schema conversion 0.0180 / 0.0982 (+0.0037) 8.3093 / 8.5640 (-0.0101) 0.0142 / 0.0184 (+0.0001) 0.0179 / 0.0233 (+0.0006) rejected: expected read path regressed
compiler precompute 0.0173 / 0.0967 (-0.0015) 8.3211 / 8.5551 (-0.0089) 0.0138 / 0.0190 (+0.0006) 0.0178 / 0.0235 (+0.0002) rejected: expected repeated-query effect was noise
ordered cache storage 0.0172 / 0.0930 (-0.0037) 8.2604 / 8.5208 (-0.0343) 0.0141 / 0.0186 (-0.0004) 0.0181 / 0.0224 (-0.0011) rejected: raw repeated queries improved more than SQLSpec, so the movement was not attributable
observability shortcuts 0.0181 / 0.0929 (-0.0001) 8.3621 / 8.5415 (+0.0207) 0.0143 / 0.0183 (-0.0003) 0.0178 / 0.0227 (+0.0003) rejected: expected path regressed or measured as noise
Litestar request shortcuts 0.0183 / 0.0998 (+0.0069) 8.2931 / 8.5176 (-0.0239) 0.0140 / 0.0190 (+0.0007) 0.0178 / 0.0237 (+0.0010) rejected: no Litestar scenario exists and covered scenarios regressed
builder lookup hoists 0.0176 / 0.0981 (-0.0017) 8.4007 / 8.5539 (+0.0363) 0.0139 / 0.0201 (+0.0011) 0.0174 / 0.0227 (-0.0010) rejected: no builder scenario exists and covered scenarios regressed

The parameter memoization proposal also failed a red regression for in-place mutation of the public coercion map and was removed. The proposed NumPy deserializer deduplication failed an existing direct-deserializer regression because that inline path is required when no decoder table is supplied; it was restored and is not claimed here.

Validation

  • uv run pytest tests/unit/utils/test_bench.py tests/unit/utils/test_bench_gate.py tests/unit/utils/test_bench_tuning.py tests/unit/utils/test_bench_subsystems.py -q — 22 passed
  • make lint — passed, including pre-commit, mypy, pyright, and slotscheck
  • make bench-gate — measurement completed; command exited nonzero on iterative-insert, write-heavy, and read-heavy thresholds as shown above

The final diff contains only the benchmark harness API update.

@codecov-commenter

codecov-commenter commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.81%. Comparing base (6bb5742) to head (22ad8b5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #640      +/-   ##
==========================================
- Coverage   76.82%   76.81%   -0.01%     
==========================================
  Files         473      473              
  Lines       66108    66108              
  Branches     9821     9815       -6     
==========================================
- Hits        50785    50781       -4     
  Misses      12031    12031              
- Partials     3292     3296       +4     
Flag Coverage Δ
integration 60.01% <ø> (-0.03%) ⬇️
py3.10 75.07% <ø> (+<0.01%) ⬆️
py3.11 75.08% <ø> (ø)
py3.12 75.09% <ø> (-0.01%) ⬇️
py3.13 75.08% <ø> (ø)
py3.14 76.00% <ø> (-0.01%) ⬇️
unit 63.93% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cofin cofin changed the title perf: streamline SQL execution hot paths fix(benchmarks): restore SQLite performance gate Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants