Repository navigation
perf: Concretely typed TopK StringHeap, and StringHashTable slot reuse - #24105
MassivePizza wants to merge 22 commits into
Conversation
6ed1b35 to
ddd9b71
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24105 +/- ##
========================================
Coverage 82.76% 82.77%
========================================
Files 1147 1147
Lines 450580 450745 +165
Branches 450580 450745 +165
========================================
+ Hits 372944 373108 +164
+ Misses 54929 54927 -2
- Partials 22707 22710 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
b6aeee8 to
4d8b2c5
Compare
avoiding from(Vec) into drop.
This restores behavior from before apache#23609.
5e604aa to
5fd2a17
Compare
There was a problem hiding this comment.
Sorry for the late review.
Thanks for working on these TopK improvements. The concrete string types and allocation reuse look like useful optimizations. I found one correctness issue around NULL group keys that I think needs to be addressed before merging. I also left a small testing suggestion for the new string heap path.
kosiew
left a comment
There was a problem hiding this comment.
Thanks for the follow-up changes. I took another pass through the updated code. The main NULL-key correctness issue still appears to be present, and the focused TopKHeap<String> regression test is still missing.
The NULL-key issue is the one blocking approval here because it can cause a valid aggregate group to be omitted from the output. I left the details inline below.
Once that is addressed, along with the requested string heap test, this should be in much better shape.
|
run benchmark topk_aggregate |
|
Benchmark for this request failed before finishing (Kubernetes reason: Benchmarks requested: Runner log (last 40 lines)Kubernetes messageFile an issue against this benchmark runner |
|
run benchmark topk_aggregate |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing topk-mutable-borrow-slots (70dea10) to 791660c (merge-base) diff Run configurationrun benchmark topk_aggregateResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing topk-mutable-borrow-slots (70dea10) to 791660c (merge-base) diff Run configurationrun benchmark topk_aggregateCPU Details (lscpu)Details
Resource Usagetopk_aggregate — base (merge-base)
topk_aggregate — branch
File an issue against this benchmark runner |
kosiew
left a comment
There was a problem hiding this comment.
Thanks for addressing the previous review comments. I've reviewed the follow-up changes and confirmed that both issues are resolved.
The separate NULL and vacant-slot sentinels correctly distinguish NULL grouping keys from freed entries, and the new regression tests cover NULL-key emission and the string heap's insertion, replacement, and drain paths.
The NULL-index collection also preserves key/value alignment during emission without requiring an intermediate vector.
I have no further concerns. LGTM!
Which issue does this PR close?
N/A.
Continuation of #23609.
Rationale for this change
Improve perf of TopK.
What changes are included in this PR?
Eliminate overhead of casting with
dyn Anyfor every String intopk::StringHeap.Rearrange
HashTableItem<ID>Option-ness to avoid unnecessary unwraps on lookups intopk::TopKHashTable.Rewrite inserts to take a borrowable type, delaying clones and allowing reuse of storage slots (mostly Strings).
Are these changes tested?
Should be covered by existing tests.
Making
IDanOption<ID>insideHashTableItemshould be fine, since the internalHashTablekeeps track of valid items (although this could be hard to verify properly). It runs with the assumption that "if everything needed an unwrap, nothing needs an unwrap".Are there any user-facing changes?
No.