Skip to content
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

Reduce memory footprint of StepBucketHistogram #4955

Open
wants to merge 2 commits into
base: 1.11.x
Choose a base branch
from

Conversation

lenin-jaganathan
Copy link
Contributor

Partially resolves #4954

I think we can also apply this safely to TimeWindowFixedBoundaryHistogram.

@lenin-jaganathan lenin-jaganathan changed the base branch from main to 1.11.x April 9, 2024 18:02
@@ -73,28 +93,49 @@ else if (value > key)
return low < buckets.length ? low : -1;
}

Iterator<CountAtBucket> countsAtValues(Iterator<Double> values) {
Iterator<CountAtBucket> countsAtValues(Iterator<Double> buckets) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just use getCountsAtBucket() instead of this? This makes a call to countAtBucket() for every bucket which in turn does a binary search to find the bucket. It makes sense if we need to get the counts for only a subset of buckets, but we don't do that anywhere (why would we even do that?). But at the end, all we need is a continuous list of buckets and their count which we can get by iterating on the values directly.

There were a few issues solved around this area hence not changing anything at this point. But,
my claim would be the buckets would not change after the histogram is created so we should always rely on the buckets from the underlying implementation (in this case FixedBucketHistogram).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve memory usage of StepBucketHistogram
1 participant