fix(rotortree): cut some cruft, improve some perf - #34
Merged
Conversation
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.
bulk
Instructions: −76.8%
This pull request significantly refactors the
ChunkedLevelimplementation incrates/rotortree/src/chunked_level.rsto simplify chunk management, improve allocation efficiency, and remove the separate "tail" buffer concept. The changes unify chunk storage, streamline chunk extension and writing, and update related APIs. The checkpoint storage code is also updated to remove now-unnecessary tail handling.Core data structure and API refactor:
ChunkedLevelstruct no longer maintains a separate fixed-size "tail" buffer for partial chunks; all hashes are managed uniformly in chunks, simplifying the logic and reducing edge cases. [1] [2] [3] [4]extend_with,write_with) allow efficient in-place initialization of chunk memory, and all appends/grows are handled through these, removing special-case tail logic.chunkandchunk_slicemethods, and iteration over runs of contiguous hashes is provided by the newrunsmethod. [1] [2]Memory allocation and initialization improvements:
from_fn,new_arc_from_fn,as_uninit_mut) to allow in-place initialization of chunk memory, reducing unnecessary copying and improving efficiency. [1] [2] [3] [4]Parallelization and utility improvements:
build_chunksutility allows parallel chunk allocation when the "parallel" feature is enabled, improving performance for large operations.Checkpoint and storage API cleanup:
write_tails,read_tails, and related fields from checkpoint data structures. [1] [2]Internal simplifications and test code updates:
These changes make the chunked tree structure more robust, easier to reason about, and more efficient, especially for large-scale or parallel operations.