rust/library/alloc/src/collections
bors ffaf857045 Auto merge of #88448 - xu-cheng:btree-blk-build, r=Mark-Simulacrum
BTreeMap/BTreeSet::from_iter: use bulk building to improve the performance

Bulk building is a common technique to increase the performance of building a fresh btree map. Instead of inserting items one-by-one, we sort all the items beforehand then create the BtreeMap in bulk.

Benchmark
```
./x.py bench library/alloc --test-args btree::map::from_iter
```

* Before
```
test btree::map::from_iter_rand_100                      ... bench:       3,694 ns/iter (+/- 840)
test btree::map::from_iter_rand_10_000                   ... bench:   1,033,446 ns/iter (+/- 192,950)
test btree::map::from_iter_seq_100                       ... bench:       5,689 ns/iter (+/- 1,259)
test btree::map::from_iter_seq_10_000                    ... bench:     861,033 ns/iter (+/- 118,815)
```

* After
```
test btree::map::from_iter_rand_100                      ... bench:       3,033 ns/iter (+/- 707)
test btree::map::from_iter_rand_10_000                   ... bench:     775,958 ns/iter (+/- 105,152)
test btree::map::from_iter_seq_100                       ... bench:       2,969 ns/iter (+/- 336)
test btree::map::from_iter_seq_10_000                    ... bench:     258,292 ns/iter (+/- 29,364)
```
2021-09-07 02:24:11 +00:00
..
btree Auto merge of #88448 - xu-cheng:btree-blk-build, r=Mark-Simulacrum 2021-09-07 02:24:11 +00:00
linked_list Implement changes suggested by @Amanieu 2021-07-01 21:08:01 +02:00
vec_deque Remove extra empty lines 2021-08-16 13:45:34 +08:00
binary_heap.rs Fix typos “an”→“a” and a few different ones that appeared in the same search 2021-08-22 18:15:49 +02:00
linked_list.rs add safety annotation to LinkedList::detach_all_nodes 2021-08-31 11:18:30 -04:00
mod.rs Don't stabilize creation of TryReserveError instances 2021-08-21 23:40:02 +01:00