Conversation
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the B‑Tree node implementation to prepare for lazy key loading by introducing a new LazyObject structure and unifying the API for handling keys and values.
- Introduces LazyObject and LazyValue, replacing earlier Value handling for lazy loading.
- Unifies API methods like get_key/get_value, key/value, and readies upcoming extract_key/extract_value.
- Updates tests and iterators to account for the new API, including changes to expected types.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/btreemap/node/v2.rs | Replaces Value with LazyValue in entry loading and writes for lazy operations. |
| src/btreemap/node/v1.rs | Updates lazy loading from Value to LazyValue and uses get_key for key ordering. |
| src/btreemap/node.rs | Refactors APIs to use LazyObject/LazyValue; adjusts keys(), search(), and entry methods. |
| src/btreemap.rs | Adjusts test assertions to expect references for keys after API changes. |
Comments suppressed due to low confidence (1)
src/btreemap.rs:3274
- [nitpick] The test has been updated to use a slice reference for keys. Confirm that this change aligns with the new API design and that all parts of the codebase expecting key ownership have been appropriately refactored.
assert_eq!(root.keys(), vec![&[6; 10_000]]);
berestovskyy
approved these changes
May 21, 2025
Contributor
berestovskyy
left a comment
There was a problem hiding this comment.
Looks good, thanks!
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.
This PR refactors the codebase to prepare for lazy key loading.
LazyObjectstructure for both keys and valuesget_key/get_value,key/value, and upcomingextract_key/extract_valueThe refactoring does not change functionality, but introduces a minor performance regression.
This is due to switching from direct key reads to indexed access, aligning with the future lazy-loading model.
The implementation is split into two parts (refactoring and actual feature) to isolate and assess performance impact in this sensitive code path.