Repository navigation
atomic-costs: record the measurement conditions on each cost-table row - #155
Merged
Merged
Conversation
3 tasks
Collaborator
Author
|
Grilling outcome (agreed with @zzylol):
Checked on the real export grid: all 18 rows get 🤖 Generated with Claude Code |
2 tasks done
Each AtomicCostEntry now carries the conditions it was measured under, read off the record's workload: items per instance, keys per instance, the value column's range and distribution, and the merge operand size. Optional on read so tables written before it still load. Part of #147. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its values are a running sum of the draws, so the draws' bounds don't bound them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zzylol
force-pushed
the
rqe-cost-measured-at
branch
from
October 6, 2026 20:28
6044945 to
c6c0bf9
Compare
This was referenced Oct 6, 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.
Part of #147 (first work item: record measurement conditions on each row).
Why
The per-phase cost model (#145) applies each cost-table row to real deployments whose instances look nothing like the benchmark's: a window of
λ·x/card(G)items instead of 1M, latencies in seconds instead of zipf ranks,card(G)keys instead of 100k. The row says nothing about the conditions it was measured under, so the optimizer can neither rescale it nor tell how far it is extrapolating.What
Every row of
approxbench atomic-costsoutput (rqe_atomic_costs.json, and the ASAPQuery table fromexport_atomic_costs.sh) gains ameasured_atblock. No new measurements: it is derived from the workload description already in each grid record. Nothing consumes it yet; the size sweep and model-side work in #147 will.How
reduce_onereads the record'sworkload. In a table description the last column is the value and the ones before it are keys; a one-column table's column is both.items_per_instancerow_num(synthetic) orrecords_loaded(external)keys_per_instancegroups_per_instancewhen the comparator reports it; else the product of the key columns' populations — an upper bound on keys actually drawnvalue_range[lo, hi](zipf[1, population], uniform[lo, hi]) plusshift;nullfor normal/Pareto and for monotonic (counter) columns, whose values are a running sum of drawsmerge_operand_itemsitems_per_instance / merge_shardsof the cost passdistributionmeasured_atisOptionwith#[serde(default)], so tables written before it still load.Before this PR
A row carried only identity, four costs and accuracy:
{"sketch": "kll-percall", "sketch_config": {"algorithm": "kll-percall", "params": {"k": 200}}, "mem_bytes_per_instance": 6400.0, "insert_cpu_secs": 2.5e-08, "merge_cpu_secs": 6.76e-06, "query_cpu_secs": 6.5e-06, "query_accuracy": {"mean_rank_err": 0.00164, "max_rank_err": 0.00734, ...}}Whether those 6.4 KB and 6.5 µs were measured on 1M or 1k items, on zipf ranks or latencies, was only recoverable by digging the workload out of
rqe_atomic_costs_grid.jsonlby hand.After this PR
The same row, plus:
A grouped exact row reports the measured group count, and a counter column no range:
Evidence
Ran this branch's reducer on the 2026-10-06 export (
out_10_6_26_1342/rqe_atomic_costs_grid.jsonl, 18 rows). Every row getsmeasured_at:The 100k key bound is loose: the same export's HLL rows estimate ~62–64k distinct keys actually drawn.
Verification
aqpbm-core/src/atomic_costs.rs):measured_at_reads_a_single_column_workload: one column is both key and value; operand = items / shards.measured_at_reads_a_labelled_workload: keys = product of label populations,shiftmoves the range, a measured group count wins over the bound.measured_at_has_no_value_range_for_a_counter_column: a monotonic column records no range.a_row_without_measured_at_still_loads: older tables deserialize.cargo test --workspace(505 passed),cargo clippy --workspace --all-targets -- -D warnings.Architectural decisions
Limitations and follow-up
keys_per_instancefor unlabelled synthetic data is the population, an upper bound.value_rangeis the generator's domain, not the observed min/max.Human review — do not complete with an agent
🤖 Generated with Claude Code