-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
BTreeMap::merge optimized
#152418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
asder8215
wants to merge
14
commits into
rust-lang:main
Choose a base branch
from
asder8215:btreemap_merge_optimized
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+370
−1
Open
BTreeMap::merge optimized
#152418
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6a2f234
feat: implement append_with() for BTreeMap
asder8215 1611b73
updated comment, used () syntax for FnMut callback, and added feature…
asder8215 8136795
corrected feature doctest name
asder8215 746641c
renamed append_with() to merge(), changed function signature, and cla…
asder8215 d3ee0fc
update issue number with tracking issue #
asder8215 2f926de
fix doctest for merge
asder8215 1b29082
Squashed doctests and merge test commits
asder8215 a7fa7dd
optimized version of BTreeMap::merge with CursorMut and unsafe code
asder8215 54499fe
with_next() and forget_next_*() created for Cursor* to handle panic b…
asder8215 97f5547
forgot to add mem::forget() on key
asder8215 9b423c5
Changed with_next() to use remove_next() + insert_after_unchecked() i…
asder8215 7a6c065
use insert_before instead of insert_after and make note on optimizing…
asder8215 f37561d
added a test to see if KV pairs are dropped on panic within conflict …
asder8215 a67cc73
added extra checks to test_id_based_merge test and clarified what mer…
asder8215 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should really be a method of
Cursor*, you need a handler for whenconflictpanics that removes the entry without dropping whatever youptr::readfrom.something like:
The equivalent
CursorMutKeymethod should instead havefbeimpl FnOnce(K, V) -> (K, V)and needs to forget both the key and value since they were bothptr::read, and not just the value.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got you 👍