Add CumulativeROHistogram for fast quantile queries#7
Open
thinkingfish wants to merge 2 commits intomainfrom
Open
Add CumulativeROHistogram for fast quantile queries#7thinkingfish wants to merge 2 commits intomainfrom
thinkingfish wants to merge 2 commits intomainfrom
Conversation
A read-only histogram variant with cumulative (prefix-sum) counts that enables O(log n) quantile lookups via binary search (with linear scan fallback for cache-line-sized data). Constructed from Histogram or SparseHistogram via From impls. Includes quantile range query methods for analytics use cases. https://claude.ai/code/session_01TT4hwxFnsHwYthuwR8eTK6
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.
Summary
Introduces
CumulativeROHistogram, a new read-only histogram variant optimized for fast quantile queries using cumulative bucket counts and binary search.Key Changes
CumulativeROHistogramtype: A read-only histogram that stores cumulative counts (running prefix sums) instead of individual bucket counts, enabling O(log n) quantile lookups via binary searchFrom<&Histogram>andFrom<&SparseHistogram>for easy construction from existing histogram typesiter()for bucket enumeration anditer_with_quantiles()to get quantile ranges alongside bucketsbucket_quantile_range()method returns the percentile range each bucket representsfrom_parts()validates index ordering, count monotonicity, and configuration boundsImplementation Details
SparseHistogram's space efficiencySampleQuantilestrait for consistent API with other histogram typeshttps://claude.ai/code/session_01TT4hwxFnsHwYthuwR8eTK6