Skip to content

perf: Concretely typed TopK StringHeap, and StringHashTable slot reuse - #24105

Draft
MassivePizza wants to merge 23 commits into
apache:mainfrom
massive-com:topk-mutable-borrow-slots
Draft

perf: Concretely typed TopK StringHeap, and StringHashTable slot reuse#24105
MassivePizza wants to merge 23 commits into
apache:mainfrom
massive-com:topk-mutable-borrow-slots

Conversation

@MassivePizza

@MassivePizza MassivePizza commented Aug 5, 2026

Copy link
Copy Markdown

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 Any for every String in topk::StringHeap.

Rearrange HashTableItem<ID> Option-ness to avoid unnecessary unwraps on lookups in topk::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 ID an Option<ID> inside HashTableItem should be fine, since the internal HashTable keeps track of valid items (although this could be hard to verify properly).

Are there any user-facing changes?

No.

@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Aug 5, 2026
@MassivePizza MassivePizza changed the title perf: Concretely typed TopK StringHeap, and improved StringHashTable slot reuse perf: Concretely typed TopK StringHeap, and StringHashTable slot reuse Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant