feat: SourceSet::PopulationRange subsumes Empty, Entity, and WholePopulation variants#854
Merged
RobertJacobsonCDC merged 1 commit intomainfrom Apr 28, 2026
Merged
Conversation
b3bb846 to
4e1b971
Compare
Benchmark ResultsHyperfine
CriterionRegressions (slower)
Improvements (faster)
Unchanged / inconclusive (CI crosses 0%)
|
4e1b971 to
6183d8e
Compare
Benchmark ResultsHyperfine
CriterionRegressions (slower)
Improvements (faster)
Unchanged / inconclusive (CI crosses 0%)
|
Collaborator
Author
|
Trivial optimizations are implemented when both sets are |
6183d8e to
2bd5f82
Compare
Benchmark ResultsHyperfine
CriterionRegressions (slower)
Improvements (faster)
Unchanged / inconclusive (CI crosses 0%)
|
…holePopulation` variants
2bd5f82 to
3b16021
Compare
Benchmark ResultsHyperfine
CriterionRegressions (slower)
Improvements (faster)
Unchanged / inconclusive (CI crosses 0%)
|
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.
Added
SourceSet::PopulationRangeVariantThis PR consolidates contiguous entity-ID sources around
PopulationRangeand carries that representation through theentity_setstack.SourceSetno longer has separate empty, whole-population, or singleton variants; those cases are now expressed canonically as ranges, with helper constructors for empty, singleton, and general population ranges. The iterator side was simplified in the same direction:SourceIteratornow relies on the range-backed path for empty and whole-population iteration, andEntitySetIteratorInnerno longer has its own dedicated empty variant.On top of that representation cleanup,
EntitySetnow has basic range-aware set algebra. Unions of overlapping or adjacent ranges collapse to a single range, intersections of ranges collapse to their overlap, and range differences simplify when the result is still empty or one contiguous range; split differences continue to use the generic expression path. The work also removed the older helper-driven empty/universal/singleton reductions that depended on the deleted variants and replaced them with a singleas_range()helper used only for the new range optimizations.The branch also updates downstream query construction and tests to match the new canonical form. Empty queries and full-population query results now construct range-backed sources, docs/comments in
entity_setwere refreshed to describe the new model, and theentity_set/iterator test coverage was rewritten and expanded to cover canonical empty/singleton/full-population ranges, optimized range operations, and the remaining non-optimized split-difference behavior.This PR replaces #826.