docs(bench): design plan for SQLRite vs SQLite benchmark suite (SQLR-4)#101
Merged
Conversation
Drafts docs/benchmarks-plan.md — comparison-target viability call (SQLite mandatory, DuckDB analytical-slice opt-in, libSQL deferred, Cloudflare D1 + rqlite out-of-scope), 10 curated workloads across OLTP / SQL-feature scaling / AI-era differentiators (HNSW, BM25, hybrid retrieval), driver-trait shape, repo layout, 6 sub-phases, and 8 open design questions. Wires into docs/_index.md "Future work" and replaces the bare "Benchmarks against SQLite" line in roadmap.md "Possible extras". No engine code yet — implementation starts post-Q-resolution as its own ticket. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7 tasks
joaoh82
added a commit
that referenced
this pull request
May 6, 2026
…9.1) (#102) First executable code for the SQLRite-vs-SQLite benchmark suite designed in #101. Stands up a `benchmarks/` workspace member with a small `Driver` trait, two engine implementations (SQLRite via `Connection`, SQLite via `rusqlite`-bundled), one workload end-to-end (W1 read-by-PK), a criterion entry point, and an aggregator that collapses `target/criterion/**/estimates.json` into a single results envelope under `benchmarks/results/`. Excluded from CI alongside `sqlrite-desktop` + the SDK cdylibs; runs locally with `make bench`. Plan-doc: - Q1-Q8 resolved on 2026-05-06 and converted to a "Decisions (was: open questions)" section, mirroring the post-resolution shape of `docs/phase-7-plan.md`. Status moved to "approved 2026-05-06 -- 9.1 in flight". - Cleaned up the muddled "Not added to the default exclude list" sentence in the Repository layout section. Harness: - `Driver` trait is small enough to express every planned workload: open / execute / execute_with_params / query_one / query_all. `&self` so drivers are cheap to clone into criterion closures. - SQLRite driver inlines `?` params via SQL formatting (SQLite-side quoting / arity checks unit-tested) -- the engine has no parameter binding yet; that lands as a post-9.6 follow-up. - SQLite driver runs the Q3-tuned profile at open time (WAL + synchronous=NORMAL + 64 MB cache + temp_store=MEMORY) and `prepare_cached` on every hot-path SELECT so we measure execution cost, not per-iter parse cost. - Per-run `TempDir` -- no page-cache / WAL bleed across iterations. - Correctness gate: every workload runs `correctness_check` against sample keys before timing, so a divergent-result "speedup" can't silently land. - Q8 versioning baked in: workloads carry a `WorkloadId { id, name, version }` and the JSON envelope tags every sample with `W{n}.v{v}`. Output: - `BenchSample` per (workload, driver) pair: median + 95% CI + mean + std dev + sample count + ops/s. - `ResultsEnvelope` carries schema_version, run timestamp, host fingerprint (CPU brand, RAM, OS kind + release, arch) and commit info (sha, branch, dirty bit). `aggregate.rs` reads sysctl / /proc / git directly -- no chrono / sysinfo deps. - `benchmarks/results/.gitignore` keeps casual local runs out of git until 9.6 commits the first official pinned-host run. Wiring: - `--exclude sqlrite-benchmarks` added to the four CI cargo commands (build, test, clippy, doc), with a comment explaining why. - `make bench` -> `benchmarks/scripts/run.sh` -> cargo bench + aggregator. `make bench-duckdb` deferred to 9.5. - CLAUDE.md "Workspace layout" + "Commands" sections updated. - `docs/_index.md` plan entry updated to reflect 9.1 shipping. Verification: - `cargo fmt --all -- --check` clean. - `cargo clippy -p sqlrite-benchmarks --all-targets` clean (engine warnings unchanged from baseline). - Full CI-equivalent build + test + doc green (--exclude desktop / python / nodejs / benchmarks). - `cargo test -p sqlrite-benchmarks` -- 5 tests pass (4 inliner + 1 ymd-from-days round-trip). - End-to-end run with `--warm-up-time 1 --measurement-time 2 --sample-size 10`: SQLRite ~12 us/op, SQLite ~2.5 us/op (~5x gap, driven by SQLRite re-parsing per call). Aggregator wrote a 2-sample JSON envelope. Refs: SQLR-4 (design), SQLR-16 (execution), #101. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs/benchmarks-plan.md— design proposal for the long-standing "Benchmarks against SQLite" item from thePossible extraslist. Mirrors the shape ofphase-7-plan.md/phase-8-plan.md: goals, scope philosophy, viability call per comparator, workloads table, methodology, repo layout, sub-phases, open questions, risks.docs/_index.md"Future work" and replaces the bare line inroadmap.md"Possible extras" with a richer entry that points at the plan + records the viability outcomes.Comparison-target viability (the call)
rusqlite; tuned tojournal_mode=WAL+synchronous=NORMALfor apples-to-apples vs SQLRite's mandatory WAL.--features duckdb. Different storage model (columnar OLAP); included to ground the "we're not DuckDB" positioning with measurement.Workload shape
10 curated workloads in three groups:
Sub-phases
Six independently-shippable PRs, ~1.5 kLOC total:
compare.py, first official run,docs/benchmarks.mdcanonical reference)Open questions
8 design questions in the doc (Q1 host pinning · Q2 SLO gates · Q3 SQLite tuning profile · Q4 DuckDB gating · Q5 libSQL timing · Q6 D1/rqlite confirmation · Q7 publishing surface · Q8 workload versioning). Leans included for each. Implementation kicks off after Q-resolution.
Test plan
cargo build/cargo testimpact is nil🤖 Generated with Claude Code