-
Notifications
You must be signed in to change notification settings - Fork 139
perf: pre-allocate Vecs and HashSets when size is known #1676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
perf: pre-allocate Vecs and HashSets when size is known #1676
Conversation
Micro-benchmark shows 1.5x-4x speedup for the allocation pattern alone (10-1000 rows group). Real-world improvement is smaller since predicate evaluation dominates.
Local benchmark shows 2-4x speedup for RowIndexBuilder initialization.
Local benchmark: 1.3-1.5x speedup for list/map materialization
…build Local benchmark shows 1.8-3x speedup for ordinal deduplication
Local benchmark: 2-5x speedup for column extraction setup.
…ession Local benchmark: 1.1-1.3x speedup
b2cb564 to
f51d98b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1676 +/- ##
=======================================
Coverage 84.63% 84.64%
=======================================
Files 125 125
Lines 34724 34733 +9
Branches 34724 34733 +9
=======================================
+ Hits 29390 29399 +9
Misses 3983 3983
Partials 1351 1351 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rtyler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is generally good hygiene and worth incorporating.
In the test transaction log which I use for validating memory performance I didn't see any noticeable changes in runtime or memory consumption. Still 👍 🚀
What changes are proposed in this pull request?
This PR improves memory allocation efficiency by pre-allocating
VecandHashSetcollections when the size is known or can be reasonably estimated. This avoids repeated reallocations as collections grow.How was this change tested?