Files
rust/library/alloc/src
Jonathan Brouwer 102a701020 Rollup merge of #153107 - asder8215:btreemap_append_optimized, r=Mark-Simulacrum
Optimize BTreeMap::append() using CursorMut

Since [`BTreeMap::merge`](https://github.com/rust-lang/rust/pull/152418#issuecomment-3959764862) uses `CursorMut` to avoid reconstructing the map from scratch and instead inserting other `BTreeMap` at the right places or overwriting the value in self `BTreeMap` on conflict, we might as well do the same for `BTreeMap::append`. This also means that some of the code in `append.rs` can be removed; `bulk_push()` however is used by `bulk_build_from_sorted_iterator()`, which is used by the `From`/`FromIterator` trait impl on `BTreeMap`. Feels like we should rename the file or place the `bulk_push()` in an existing file.

The same additional optimization consideration that `BTreeMap::merge` has is also applied to `BTreeMap::append`.

r? @Mark-Simulacrum  since Mark has seen the `BTreeMap::merge` code already (only diff is the `Ordering::Equal` case and now one of the test assertions on a panic case has the correct value now).
2026-03-23 12:14:52 +01:00
..
2026-03-14 22:09:35 -04:00
2026-03-14 22:09:35 -04:00
2026-02-07 17:20:39 +03:00
2026-03-14 22:09:35 -04:00