-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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: prefer bulk_steal functions over specialized ones #81115
Conversation
Can you post some benchmark results? |
@bors try @rust-timer queue |
Awaiting bors try build completion. |
⌛ Trying commit c085f973181151124e1bf16e6c8ec01f9ef2e354 with merge 6937a6221a72897ad82bb2282e87e24eec9227e6... |
☀️ Try build successful - checks-actions |
Queued 6937a6221a72897ad82bb2282e87e24eec9227e6 with parent d51cf96, future comparison URL. @rustbot label: +S-waiting-on-perf |
Finished benchmarking try commit (6937a6221a72897ad82bb2282e87e24eec9227e6): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
The benchmarks exercising the steal functions are the |
r=me with conflict resolved. FWIW, it looks like steal is maybe not a great name for these functions - I have usually seen them called left/right rotations. (The intuition is that the elements on the left node go up to the parent and the parent goes down to the right child, i.e., rotating in some sense). Steal to me implies a return type containing key/value pairs but it's not the case here. |
c085f97
to
4775334
Compare
I didn't get notification of that conflict, and worse I didn't realize it was the same
I kind of like the name. I would have probably chosen a boring verb like "move" had I invented them.
I only know the term from work stealing in scheduling, and it never implied any return type to me. But not you say that, it does remind me of one API long ago where "get_x" actually stole x. There "get" meant what it means in English: take, grab, seize, steal. |
I think "move_left" or "steal_left" both imply to me action solely taken on the left node. left rotate (note: not rotate left) somewhat does not. @bors r+ rollup |
📌 Commit 4775334 has been approved by |
I did tentatively rename it to "steal_left_to_right" earlier, because I was confused by the direction: does it steal stuff from the left sibling, to be made the left part of the node, or does it steal the left part and leave the loot in the right sibling (after exchanging some of the loot in the middle to shake off the cops). |
…Mark-Simulacrum BTreeMap: prefer bulk_steal functions over specialized ones The `steal_` functions (apart from their return value) are basically specializations of the more general `bulk_steal_` functions. This PR removes the specializations. The library/alloc benchmarks say this is never slower and up to 6% faster. r? `@Mark-Simulacrum`
…laumeGomez Rollup of 8 pull requests Successful merges: - rust-lang#80382 (Improve search result tab handling) - rust-lang#81112 (Remove unused alloc::std::ops re-export.) - rust-lang#81115 (BTreeMap: prefer bulk_steal functions over specialized ones) - rust-lang#81147 (Fix structured suggestion for explicit `drop` call) - rust-lang#81161 (Remove inline script tags) - rust-lang#81164 (Fix typo in simplify.rs) - rust-lang#81166 (remove some outdated comments regarding debug assertions) - rust-lang#81168 (Fixes rust-lang#81109 - Typo in pointer::wrapping_sub) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The
steal_
functions (apart from their return value) are basically specializations of the more generalbulk_steal_
functions. This PR removes the specializations. The library/alloc benchmarks say this is never slower and up to 6% faster.r? @Mark-Simulacrum