refactor(data): replace PartialVec tree structure with flat entry list#747
Merged
vapourismo merged 1 commit intomainfrom Feb 2, 2026
Merged
refactor(data): replace PartialVec tree structure with flat entry list#747vapourismo merged 1 commit intomainfrom
vapourismo merged 1 commit intomainfrom
Conversation
747e440 to
54edab0
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #747 +/- ##
==========================================
- Coverage 89.99% 89.97% -0.02%
==========================================
Files 109 109
Lines 20672 20656 -16
Branches 20672 20656 -16
==========================================
- Hits 18603 18585 -18
- Misses 1690 1692 +2
Partials 379 379 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
54edab0 to
6327543
Compare
9 tasks
6327543 to
50cc766
Compare
194c58a to
59ef99a
Compare
6daf57b to
397d10c
Compare
59ef99a to
7eb2c38
Compare
397d10c to
681eec3
Compare
2660fee to
ab3616b
Compare
681eec3 to
71e0ee3
Compare
ab3616b to
6e252c0
Compare
a837c5e to
8099b8d
Compare
|
Benchmark results for revision fd6d89a:
Full results
Compare the results above with those for the default branch. |
e1972da to
61f279d
Compare
emturner
reviewed
Jan 29, 2026
0db28c3 to
a939292
Compare
a939292 to
98abd54
Compare
NSant215
reviewed
Jan 30, 2026
Contributor
NSant215
left a comment
There was a problem hiding this comment.
there is a PartialVec::undefined that has been missed in bytes.rs that is causing local build to fail
98abd54 to
4747120
Compare
The previous binary tree implementation (Undefined/Defined/Concatenated enum) suffered from unbounded tree depth when many small ranges were defined, risking stack overflow during traversal. Replace with a flat Vec<DefinedEntry> sorted by start index, where gaps implicitly represent undefined regions. This eliminates recursion depth issues and simplifies the implementation: - `define()` uses binary search to find insertion points - `truncate()` and `range()` become simple linear operations - `undefined()` no longer takes a length parameter (gaps are implicit) - Removes unsafe pointer manipulation from truncate() The new structure maintains O(log n) lookup via partition_point while avoiding the fragmentation and depth issues of the tree approach.
4747120 to
297c5e4
Compare
Collaborator
Author
Thanks! Fixed now. |
victor-dumitrescu
approved these changes
Feb 2, 2026
emturner
approved these changes
Feb 2, 2026
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.
Relates to RV-861
What
Simplifies the
PartialVecdata structure. It maintains its memory-efficient representation but uses a flat list of entries instead of a tree structure.While this makes the code simpler and safer, it comes at the cost of worse time complexity for insertions, as range entries need to be moved in memory to maintain order. The data itself doesn't require moving, but the anchoring entries do.
In essence, this PR trades efficiency for increased safety and simplicity.
Why
The tree-based approach has a critical flaw: its
Dropimplementation can overflow the stack when the tree is nested too deeply. Fixing this requires even more complexity to be baked into the module. To avoid more complexity, I chose to overhaul the implementation.This PR addresses this while also making the module more accessible.
Manually Testing
Tasks for the Author