| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
|
|
|
|
|
|
|
|
|
|
Revert the fundamental changes in #74762 and #75257
Before possibly going over to #75487. Also contains some added and fixed comments.
r? @Mark-Simulacrum
|
|
Migrate unit tests of btree collections to their native breeding ground
There's one BTreeSet test case that I couldn't easily convince to come along, maybe because it truly is an integration test. But leaving it in place would mean git wouldn't see the move so I also moved it to a new file.
r? @Mark-Simulacrum
|
|
BTreeMap: refactor splitpoint and move testing over to unit test
r? @Mark-Simulacrum
|
|
BTreeMap: purge innocent use of into_kv_mut
Replace the use of `into_kv_mut` into more precise calls. This makes more sense if you know that the single remaining use of `into_kv_mut` is in fact evil and can be trialled in court (#75200) and sent to a correction facility (#73971).
No real performance difference reported (but functions that might benefit a tiny constant bit like `BTreeMap::get_mut` aren't benchmarked):
```
benchcmp old new --threshold 5
name old ns/iter new ns/iter diff ns/iter diff % speedup
btree::map::clone_fat_100 63,073 59,256 -3,817 -6.05% x 1.06
btree::map::iter_100 3,514 3,235 -279 -7.94% x 1.09
```
|
|
|
|
|
|
|
|
Stop BTreeMap casts from reborrowing
Down in btree/node.rs, the interface and use of `cast_unchecked` look a bit shady. It's really just there for inverting `forget_type` which does not borrow. By borrowing we can't write the same `cast_unchecked` in the same way at the Handle level.
No change in undefined behaviour or performance.
|
|
|
|
|
|
|
|
|
|
Deriving debug prints all the values including keys. But ValuesMut
struct should only print the values.
|
|
|
|
|
|
Implement `into_keys` and `into_values` for associative maps
This PR implements `into_keys` and `into_values` for HashMap and BTreeMap types. They are implemented as unstable, under `map_into_keys_values` feature.
Fixes #55214.
r? @dtolnay
|
|
|
|
|
|
BTreeMap: better way to postpone root access in DrainFilter
A slightly more elegant (in my opinion) adaptation of #74762. Benchmarks seem irrationally pleased to:
```
benchcmp old new --threshold 5
name old ns/iter new ns/iter diff ns/iter diff % speedup
btree::map::clone_fat_100_and_remove_all 215,182 185,052 -30,130 -14.00% x 1.16
btree::map::clone_fat_100_and_remove_half 139,667 127,945 -11,722 -8.39% x 1.09
btree::map::clone_fat_val_100_and_remove_all 96,755 81,279 -15,476 -16.00% x 1.19
btree::map::clone_fat_val_100_and_remove_half 64,678 56,911 -7,767 -12.01% x 1.14
btree::map::find_rand_100 18 17 -1 -5.56% x 1.06
btree::map::first_and_last_0 33 35 2 6.06% x 0.94
btree::map::first_and_last_100 40 54 14 35.00% x 0.74
btree::map::insert_rand_100 45 42 -3 -6.67% x 1.07
btree::map::insert_rand_10_000 45 41 -4 -8.89% x 1.10
btree::map::iter_0 2,010 1,759 -251 -12.49% x 1.14
btree::map::iter_100 3,514 2,764 -750 -21.34% x 1.27
btree::map::iter_10k 4,018 3,768 -250 -6.22% x 1.07
btree::map::range_unbounded_unbounded 37,269 28,929 -8,340 -22.38% x 1.29
btree::map::range_unbounded_vs_iter 31,518 28,814 -2,704 -8.58% x 1.09
```
r? @Mark-Simulacrum
|
|
BTreeMap: enforce the panic rule imposed by `replace`
Also, reveal the unsafe parts in the closures fed to it.
r? @Mark-Simulacrum
|
|
|
|
|
|
|
|
|
|
|
|
Clarify reuse of a BTreeMap insert support function and treat split support likewise
r? @Mark-Simulacrum
|
|
|
|
|
|
Make tests faster in Miri
Reduce some test iteration counts in Miri.
|
|
BTreeMap: define forget_type only when relevant
Similar to `forget_node_type` for handles.
No effect on generated code, apart maybe from the superfluous calls that might not have been optimized away.
r? @Mark-Simulacrum
|
|
r=Mark-Simulacrum
BTreeMap::drain_filter should not touch the root during iteration
Although Miri doesn't point it out, I believe there is undefined behaviour using `drain_filter` when draining the 11th-last element from a tree that was larger. When this happens, the last remaining child nodes are merged, the root becomes empty and is popped from the tree. That last step establishes a mutable reference to the node elected root and writes a pointer in `node::Root`, while iteration continues to visit the same node.
This is mostly code from #74437, slightly adapted.
|
|
BTreeMap: remove into_slices and its unsafe block
A small tweak to make BTreeMap code shorter and less unsafe.
r? @Mark-Simulacrum
|
|
|
|
|
|
|
|
|
|
|
|
Closes #70929.
|
|
|