Repository navigation
rqe cost export: count top-k heaps, time top-k queries above the clock floor, add exact hash-table overhead - #151
Merged
Merged
Conversation
…ash-table overhead - CMS+heap and CountSketch+heap memory now adds CMS_HEAP_TOP_K HHItems, as UnivMon counts its heaps, so the TopK rows compare like for like (#146). - TopkGT asks its one question 1024 times per pass, as CardinalityGT does, and the CMS/CS/UnivMon top-k queries answer once per probe, so a pass sits above the timer floor and work = answers keeps per-op CPU per call. - Exact accumulators' footprint adds an estimate of hashbrown's table: capacity x (key + cell + 1 control byte). Closes #146. Part of #147. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks
…ctor dependence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Grilling outcome (agreed with @zzylol):
🤖 Generated with Claude Code |
This was referenced Oct 6, 2026
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.
Closes #146. Part of #147 (the "Per-op fixes").
Why
The per-phase cost model (#145) multiplies each cost-table row's memory and CPU by deployment counts, so a per-instance error is multiplied too. Three rows were measured inconsistently:
TopKcandidates, so they weren't compared like for like.getrusagecan resolve, so the recorded query CPU was mostly the cost of the measurement itself.What
Only the benchmark's measurements change; the cost-table format is unchanged. After the next
scripts/export_rqe_optimizer_costs.shrun:How
memory_cms_heap_lib_vector2d_{fast,regular}andmemory_cs_heap_lib_vector2d_fastaddCMS_HEAP_TOP_K × size_of::<HHItem>()(32 × 48 B), asmemory_univmon_libalready does.TopkGT::probes()asks its one question 1024 times (QUERY_TIMING_REPEATS), asCardinalityGTdoes for HLL. The CMS-heap (fast and regular), CountSketch-heap and UnivMon top-k queries dump the heap once per probe. The work count is the number of answers, so CPU per op stays per call. Scoring uses the first answer, so accuracy is unchanged.Multiple::footprintestimates hashbrown's table ascapacity × (size_of key + size_of cell + 1 control byte), plus the strings and cell heap each group owns. Capacity is what is allocated, so the per-group share depends on the load factor at the measured group count: about 1.44 slots per group at the export's ~9.9k groups, and between 1 and 2 elsewhere.Before this PR
Two top-k rows of the same shape differed 34× in query cost, and the numbers didn't track how much work a dump does.
After this PR
Evidence
Query CPU: clnode109 (idle 56-core, load ≈ 1), release builds of
f130b23(before) anda8ee5ed(this PR),--operations query --metrics throughput,cpu --runs 5 --warmup-runs 3, zipf s=1.1, 1M items, 100k keys, seed 42. CPU per call = total query CPU ÷ total calls.Memory: deterministic, from release builds of the same two commits (
--operations insert --metrics throughput,memory). cms-heap 3×2048 24,576 → 26,112 B; countsketch-heap 5×2048 40,960 → 42,496 B; exact-sum onhydra_columns.yaml(9,950 groups) 1,117,624 → 1,272,312 B; exact-increase oncounter_columns.yaml1,754,424 → 2,189,816 B.Verification
footprint_is_counters_plus_heap(cms_heap/mod.rs): the footprint is the counters plus a full heap ofHHItems, for both the fast and regular paths. It replaces the old counters-only assertion.cargo test --workspace,cargo clippy --workspace --all-targets -- -D warnings, CI (format-and-lint, test).Architectural decisions
TopkGT, and the three top-k families should be measured alike.Limitations and follow-up
Human review — do not complete with an agent
🤖 Generated with Claude Code