feat: expose estimated_size for countmin and frequencies sketches - #174
Merged
tisonkun merged 5 commits intoAug 1, 2026
Merged
Conversation
Follow the pattern from PR apache#136: report size_of::<Self>() plus the heap allocations of the backing tables, using capacity rather than length. Addresses apache#137
Renkai
force-pushed
the
feat/estimated-size-countmin-frequencies
branch
from
August 1, 2026 03:20
3b6881f to
1e3df46
Compare
Renkai
marked this pull request as ready for review
August 1, 2026 03:22
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
tisonkun
approved these changes
Aug 1, 2026
tisonkun
left a comment
Member
There was a problem hiding this comment.
Thanks for your contribution!
tisonkun
enabled auto-merge (squash)
August 1, 2026 06:26
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.
This is a follow-up of #136, addressing part of #137.
Add
estimated_size()to the remaining sketches that don't report their memory footprint yet:CountMinSketch:size_of::<Self>()plus the capacity of thecountsandhash_seedsbacking vectorsFrequentItemsSketch:size_of::<Self>()plus the heap allocations of the internalReversePurgeItemHashMap(keys/values/states arrays)The implementation follows the pattern established in #136: heap usage is measured by allocation capacity, and nested storage types expose their own
estimated_size()helper.Tests: added one case per sketch (
countmin_test,frequencies_test). Verified withcargo x check,cargo x test, andcargo x lint.