Keep track of position when deleting from a BTreeMap#70795
Keep track of position when deleting from a BTreeMap#70795bors merged 2 commits intorust-lang:masterfrom
Conversation
This improves the performance of drain_filter and is needed for future Cursor support for BTreeMap.
a56b338 to
7365748
Compare
|
Looks good to me, thanks! We should really look into caching the last_leaf_edge/first_leaf_edge I suspect, to avoid the (presumably) fairly expensive tree traversals on every non-leaf node we're visiting. @bors r+ |
|
📌 Commit 7365748 has been approved by |
|
Oh, actually, one nit, but then r=me @bors r- |
| AtRoot, | ||
| Merged(Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::Edge>, bool, usize), | ||
| Stole(NodeRef<marker::Mut<'a>, K, V, marker::Internal>, bool), | ||
| Stole(bool), |
There was a problem hiding this comment.
Nice, but now Stole is begging me to be split up into something like StoleFromLeft and StoleFromRight.
There was a problem hiding this comment.
But then I would have to do the same with MergedWithRight and MergedWithLeft, and that makes just makes the match above more complicated.
|
I think further improvements to the enum can be cleared up later, for now this seems fine. @bors r+ |
|
📌 Commit 51357cf has been approved by |
Rollup of 5 pull requests Successful merges: - rust-lang#67797 (Query-ify Instance::resolve) - rust-lang#70777 (Don't import integer and float modules, use assoc consts) - rust-lang#70795 (Keep track of position when deleting from a BTreeMap) - rust-lang#70812 (Do not use "nil" to refer to `()`) - rust-lang#70815 (Enable layout debugging for `impl Trait` type aliases) Failed merges: r? @ghost
|
Performance measurement of this PR against its master revision: In short, some backlash on |
|
I'm getting completely different results on my system: |
|
Well, completely different... both say there's no significant change to worry about. I shouldn't have written there is backlash, that's just what the numbers seemed to suggest. |
…, r=Amanieu Remove the Ord bound that was plaguing drain_filter Now that rust-lang#70795 made it superfluous. Also removes superfluous lifetime specifiers (at least I think they are).
…, r=Amanieu Remove the Ord bound that was plaguing drain_filter Now that rust-lang#70795 made it superfluous. Also removes superfluous lifetime specifiers (at least I think they are).
|
I rebuilt the commits (the base and tip of your branch) and tweaked cargo-benchcmp to pick the best result for each benchmark over many runs (whereas before I hand-picked the seemingly best output file from 5 runs). Now I seem to get quite consistent output, within 2%, like: Of course, it doesn't mean that the code tested is a wee bit faster or slower, probably just that, for this set of benchmarks, the optimizer ends up favouring other benchmarks than it did before. And I wouldn't be surprised that the software picks up on this and starts countermeasures so it can keep on doing what it wants to. |
This improves the performance of drain_filter and is needed for future Cursor support for BTreeMap.
cc @ssomers
r? @Mark-Simulacrum