Skip to content
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

BTreeMap/BTreeSet: add drain and split_off_range methods #81075

Open
wants to merge 1 commit into
base: master
from

Conversation

@ssomers
Copy link
Contributor

@ssomers ssomers commented Jan 16, 2021

Implements #81074
r? @Mark-Simulacrum

@Mark-Simulacrum
Copy link
Member

@Mark-Simulacrum Mark-Simulacrum commented Jan 16, 2021

Is there a chance we can split this up into more commits? Reviewing a diff in a couple thousand lines is going to be quite challenging. It would be good to document any design decisions or otherwise guide my review, too.

@ssomers
Copy link
Contributor Author

@ssomers ssomers commented Jan 16, 2021

I can split off a few refactorings of existing functions, to open up for new use, but they seemed a bit pointless on their own (apart from one thing that I actually postponed).

@Mark-Simulacrum
Copy link
Member

@Mark-Simulacrum Mark-Simulacrum commented Jan 16, 2021

I don't really know what you postponed, but I will likely not be able to effectively review this diff without at least some guidance as to where to start or the overall vision in adding these methods.

@ssomers
Copy link
Contributor Author

@ssomers ssomers commented Jan 16, 2021

The item I postponed is that steal_X functions (apart from their return value) are basically a hand-written optimization of the generic bulk_steal_X functions for count=1 (in reality, it went the other way around of course). It comes up here because one of the functions needed for drain is identical to handle_shrunk_node_recursively apart from that alleged optimization.

@ssomers
Copy link
Contributor Author

@ssomers ssomers commented Jan 16, 2021

The overall vision in adding these methods is to not copy any existing functionality, but break it up in order to reuse parts. I'll feed those refactings in a few separate PRs now.

@bors
Copy link
Contributor

@bors bors commented Jan 17, 2021

The latest upstream changes (presumably #81083) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

@bors bors commented Jan 19, 2021

The latest upstream changes (presumably #81169) made this pull request unmergeable. Please resolve the merge conflicts.

@ssomers ssomers force-pushed the ssomers:btree_drain branch 3 times, most recently from 4e62119 to d111d91 Jan 19, 2021
@ssomers ssomers force-pushed the ssomers:btree_drain branch from d111d91 to 52ebac0 Jan 25, 2021
@bors
Copy link
Contributor

@bors bors commented Jan 29, 2021

The latest upstream changes (presumably #81073) made this pull request unmergeable. Please resolve the merge conflicts.

@ssomers ssomers force-pushed the ssomers:btree_drain branch from 52ebac0 to 2183142 Feb 7, 2021
@bors
Copy link
Contributor

@bors bors commented Feb 9, 2021

The latest upstream changes (presumably #81361) made this pull request unmergeable. Please resolve the merge conflicts.

@ssomers ssomers force-pushed the ssomers:btree_drain branch 2 times, most recently from ad80c11 to 24ec3f4 Feb 9, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2021
BTreeMap: gather and decompose reusable tree fixing functions

This is kind of pushing it as a standalone refactor, probably only useful for rust-lang#81075 (or similar).
r? `@Mark-Simulacrum`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 13, 2021
…rk-Simulacrum

BTreeMap: gather and decompose reusable tree fixing functions

This is kind of pushing it as a standalone refactor, probably only useful for rust-lang#81075 (or similar).
r? `@Mark-Simulacrum`
@bors
Copy link
Contributor

@bors bors commented Feb 13, 2021

The latest upstream changes (presumably #81494) made this pull request unmergeable. Please resolve the merge conflicts.

@ssomers ssomers force-pushed the ssomers:btree_drain branch from 24ec3f4 to a100d8d Feb 14, 2021
@bors
Copy link
Contributor

@bors bors commented Feb 15, 2021

The latest upstream changes (presumably #82103) made this pull request unmergeable. Please resolve the merge conflicts.

@ssomers ssomers force-pushed the ssomers:btree_drain branch from a100d8d to 2fbf6a8 Feb 15, 2021
@bors
Copy link
Contributor

@bors bors commented Feb 21, 2021

The latest upstream changes (presumably #82359) made this pull request unmergeable. Please resolve the merge conflicts.

@ssomers ssomers force-pushed the ssomers:btree_drain branch from 2fbf6a8 to a74fa3b Feb 21, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 22, 2021
…rk-Simulacrum

BTreeMap: gather and decompose reusable tree fixing functions

This is kind of pushing it as a standalone refactor, probably only useful for rust-lang#81075 (or similar).
r? `@Mark-Simulacrum`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 22, 2021
…rk-Simulacrum

BTreeMap: gather and decompose reusable tree fixing functions

This is kind of pushing it as a standalone refactor, probably only useful for rust-lang#81075 (or similar).
r? `@Mark-Simulacrum`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 22, 2021
…rk-Simulacrum

BTreeMap: gather and decompose reusable tree fixing functions

This is kind of pushing it as a standalone refactor, probably only useful for rust-lang#81075 (or similar).
r? `@Mark-Simulacrum`
@bors
Copy link
Contributor

@bors bors commented Feb 22, 2021

The latest upstream changes (presumably #81362) made this pull request unmergeable. Please resolve the merge conflicts.

@ssomers ssomers force-pushed the ssomers:btree_drain branch from a74fa3b to 6f78bae Feb 23, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 1, 2021
…rk-Simulacrum

BTreeMap: split up range_search into two stages

`range_search` expects the caller to pass the same root twice and starts searching a node for both bounds of a range. It's not very clear that in the early iterations, it searches twice in the same node. This PR splits that search up in an initial `find_leaf_edges_spanning_range` that postpones aliasing until the last second, and a second phase for continuing the search for the range in the each subtree independently (`find_lower_bound_edge` & `find_upper_bound_edge`), which greatly helps for use in rust-lang#81075. It also moves those functions over to the search module.

r? `@Mark-Simulacrum`
@ssomers ssomers force-pushed the ssomers:btree_drain branch from 6f78bae to 54fbc4d Mar 1, 2021
@ssomers
Copy link
Contributor Author

@ssomers ssomers commented Mar 1, 2021

@rustbot label: -S-waiting-on-author +S-waiting-on-review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants