Repository navigation
Benchmark fairness: query time, kept processes, tie-safe accuracy, honest periodic and planeval costs, measured sketch heap - #286
Merged
Conversation
DuckDB, psql and PilotDB start a process for every run, so their wall time includes starting it (for PilotDB also Python, its imports and a row count of every table), while ClickHouse and Druid keep a connection. Each engine now names its query time: the time it reports for the three that start a process, as ClickBench reports them, and the harness wall time otherwise. speedup_over_* and the leaderboard data divide it; the wall columns stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each DuckDB and PilotDB run was a new process, so every hot run started with a cold in-process buffer pool, while ClickHouse, PostgreSQL and Druid keep theirs. Both adapters now keep one process for the whole configuration: DuckDB's shell reads each query from its input, PilotDB's driver serves one JSON request per line and holds a connection so the database instance outlives each execute_aqp call. restart() starts the process again, so cold runs still start cold. The harness reads a kept process's CPU from /proc around each run and its peak memory from VmHWM, reset through clear_refs before the run; a run in which the process started or exited is not measured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A query without GROUP BY or DISTINCT was compared row by row by position, so a tie in its ORDER BY counted as an error: on ClickBench query 25 (ORDER BY EventTime LIMIT 10) the truth's own runs disagreed and every exact engine had 6 to 8 differing cells. Such rows now match in value order, and a query whose truth runs disagree gets no accuracy, as the query does not fix its answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eries When ASAPQuery-backend's queries do not plan together, each runs in an instance of its own. The benchmark runs them one after another, but a deployment runs them at the same time, so the peak resident bytes are now the sum of the instances' peaks; the largest instance's stays alongside. A query the reference system does not support is answered by the in-process exact plan and is not in that system's latency, CPU or memory, while the candidate's include it. Each report now lists the queries each system asked, the latency of both over the queries both asked, and says when their CPU and memory cover different queries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
state_bytes counted only sketch summaries and charged every other stored value 0, and raw data at query time counted 16 bytes per sample with no labels. A stored state is now charged every value it holds, by type (8 bytes for a number or a timestamp, a string's length), and each sketch once however many rows share it. Each evaluation also reports the label bytes of the series it read, which run_use_case.py adds to the query memory. The executor's own Batch::memory_bytes is not used: once a query has read a stored state, the batch counts its sketches as held outside the run and charges them nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each evaluation turned the raw samples it reads into executor rows, serializing every series' labels to JSON, inside query_seconds. Only the plans that read raw samples paid it, so it raised the exact arm's latency and the speedups against it. That time is now raw_batch_seconds, taken out of query_seconds and refresh_seconds as compile time already was, and run_use_case.py reports it as its own mean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
planeval timed every evaluation once, on whatever core the thread was on, with no check that the core was idle. It now takes --core, --runs (odd, default 5), --warmup-runs and --max-core-busy, as benchmark-external does: each evaluation's query runs through Protocol::run_job_after (pinned, idle-checked before and after, the median of the measured runs), and the refresh, which changes stored state, runs once under the same checks. Each cost records the core, the busy fractions and the marks. Without --core nothing is pinned or checked and the cost says so. run_use_case.py passes the four options on; the callers that only need answers (the truth in run_use_case_on_systems.py, inject_errors.py) run each evaluation once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sketch-bench timed every run on whatever core the thread was on and never checked the core was idle; only run_throughput_fast.sh pinned it, from outside. sketchbench now takes --core and --max-core-busy (default 0.10): the measuring thread is pinned, the core's busy fraction is read before and after every run (one run's after-sample is the next one's before), a core busier than the limit before a run refuses it and after a run marks it. Records carry the core, the largest busy fractions and the marks; without --core, or with --workers above 1, they say NotPinned and IdleNotChecked. run_profiles.sh and run_throughput_fast.sh pass --core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
memory_bytes is each wrapper's own formula (sketch_oxide's HLL is 1 << lg_k, Apache DataSketches' is its register count). heap-track was off by default, and when on it measured only what the timed run allocated, so a sketch built before the clock started measured 0. heap-track is now a default feature of approxbench, and every pass is built on its own with the heap read before and after, so each run's heap_bytes_peak is the heap its pass held once built plus the most the run added on top. Over 1M zipf items: HyperLogLog lg_k=14 (sketchlib) 16408 measured against 16400 declared, Count-Min 5x2048 (sketch_oxide) 81992 against 81920, Polars' exact baseline 8388656 against 8388608, KLL k=200 (sketchlib) 13968 against 9864. A merge pass holds every shard and a query pass its answers, so theirs are larger than one sketch's memory_bytes. The counters are process-wide, so a run with --workers above 1 leaves them out. heap_track_leak now runs with the workspace's default features; its deltas allow 1 KiB of other threads' allocations, which made it fail about one run in eight. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A system's "cpu seconds" is its server's CPU over the whole arm, ingest and queries together. When ASAPQuery-backend's queries plan apart, every instance ingests the whole data, so the sum of the instances charged the data's ingest once per instance. On use case 3 (5 instances) the backend summed to 25.6 s against VictoriaMetrics' 23.4 s, of which 19.5 s was ingest repeated five times; its queries took 5.7 s against 10.1 s. Each summary now also records ingest cpu seconds and query cpu seconds, summed from the server CPU the harness reads around every ingest and every evaluation step. A run in several instances adds the largest instance's ingest, which is one ingest of the data, and says how many times the data was ingested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fixes record more than the leaderboard and Grafana read. Each leaderboard record now also has: - query_time (one-shot): whether its speedups divide the engine's own time or the harness's wall time; results written before it existed divided wall time, so they say harness_wall. - query_cpu_seconds, ingest_cpu_seconds and ingest_cpu_seconds_one_instance (periodic): the server CPU of the queries and of the ingest, the ingest summed over the instances and of the largest one. - cpu_and_memory_comparable (periodic): whether both systems asked the same queries, so their whole-run CPU and memory compare. schema.json knows the new keys, so the page does not warn about them, and benchmarkRecord.js holds each to its benchmark. A use-case run of run_use_case.py records how planeval measured each arm: the cores, the query runs, the busiest core reading and the marks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 3, 2026
Merged
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.
Measurement problems that made one system, arm or library look better or worse than it is. Each was checked against the code (and, where results exist, the 2026-12-01 archive) before the fix; one commit per problem, and every commit builds on its own.
speedup_over_*divided wall times, which for DuckDB, psql and PilotDB include starting a process every run (PilotDB also Python, its imports and a row count of every table); ClickHouse and Druid keep a connectionrestart()starts it again, so cold runs stay cold; a process that exits is started again. CPU from/procaround each run, peak memory from VmHWM reset throughclear_refsstate_bytescounted only sketch summaries, every other stored value 0; raw reads counted 16 B per sample without labelsBatch::memory_bytesis not used: after a query reads a stored state it charges that state's sketches nothing)query_secondsincluded turning raw samples into executor rows and JSON-serializing every series' labels, which only raw-reading (exact) plans payraw_batch_seconds, out of query and refresh time--core,--runs(default 5),--warmup-runs,--max-core-busy; the query runs throughProtocol::run_job_after(pin, idle check before and after, median), the refresh once under the same checks;run_use_case.pypasses them on, answer-only callers run oncesketchbench --corepins and checks the core around every run (refuses a busy core before, marks one after); without it, or with--workersabove 1, the record says NotPinned / IdleNotChecked. The repository's profile scripts pass--corememory_bytesis each wrapper's own formula; heap-track was off by default and, when on, missed a sketch built before the clock started (it read 0)heap-trackis a default feature and every pass is built on its own with the heap read before and after, soheap_bytes_peakis the heap the pass held once built plus what the run addedcpu secondsis the server over the whole arm, ingest included; with several backend instances the data's ingest was charged once per instanceingest cpu secondsandquery cpu secondsrecorded apart (from the server CPU around every ingest and evaluation step), plus the largest instance's ingest, which is one ingestquery_time,query_cpu_seconds,ingest_cpu_seconds,ingest_cpu_seconds_one_instance,cpu_and_memory_comparable(known toschema.json); use-case runs record how planeval measured each armNot changed here, by decision: the items that were only partly true and the documented capability limits; psql still starts per run (PostgreSQL's buffer pool is the server's, and its speedup now uses
\timing); the docs.Before and after
origin/mainand this branch, same machine, same settings, a few configurations each.One-shot, ClickBench Q1/Q3/Q25/Q30, DuckDB and ClickHouse with 16 threads, PilotDB 5% on Q3/Q30, 4 runs:
Q25 had 9–10 differing text cells on every exact engine before; now it gets no accuracy (the truth's runs disagree). DuckDB's per-run peak memory now includes its kept buffer pool, as the servers' does.
planeval, use case 5, exact against
noraw-ignore-eps0.05:Of the old exact time, rebuilding raw batches was 159 ms / 27 ms per evaluation. Exact query memory now counts labels: 2.40 MB → 3.35 MB; the sketches' state bytes are unchanged (25,570 / 5,120).
Periodic, VictoriaMetrics against ASAPQuery-backend
noraw-ignore-eps0.01(backend at 8263b22b): use case 3 runs the backend in 5 instances; its peak was reported as 67 MB (the largest instance), now 305 MB (all five). Split from that run: backend 19.5 s ingest (4.5 s in its largest instance) and 5.7 s queries, VictoriaMetrics 12.1 s ingest and 10.1 s queries — the whole-arm 25.6 s against 23.4 s was mostly the data ingested five times. Use case 5 plans in one instance; its numbers moved within run-to-run noise.sketchbench, 1M zipf items, insert: HyperLogLog lg_k=14 (sketchlib) measures 16,408 B against 16,400 declared (0 before), Count-Min 5×2048 (sketch_oxide) 81,992 against 81,920, Polars' exact baseline 8,388,656 against 8,388,608, KLL k=200 (sketchlib) 13,968 against 9,864. Insert throughput with and without heap-track: 29.0 / 29.1 M items/s (sketch_oxide HLL), 99.8 / 99.3 (Polars).
Checks:
cargo fmt --check,cargo clippy --workspace --all-targets --all-features -D warnings,cargo test --workspace,cargo test -p system-bench --features planeval, the Python use-case tests; the real DuckDB and PilotDB adapter tests withAQPBM_DUCKDB/AQPBM_PILOTDB_PYTHONset.🤖 Generated with Claude Code