rust/library/alloc/src
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
..
alloc Rename AllocRef to Allocator and (de)alloc to (de)allocate 2020-12-04 14:47:15 +01:00
collections Auto merge of #88448 - xu-cheng:btree-blk-build, r=Mark-Simulacrum 2021-09-07 02:24:11 +00:00
prelude mv std libs to library/ 2020-07-27 19:51:13 -05:00
raw_vec Rename AllocRef to Allocator and (de)alloc to (de)allocate 2020-12-04 14:47:15 +01:00
rc Re-stabilize Weak::as_ptr &friends for unsized T 2021-01-06 19:30:22 -05:00
sync Rollup merge of #80764 - CAD97:weak-unsized-as-ptr-again, r=RalfJung 2021-01-16 17:29:56 +00:00
vec Constified Default implementations 2021-08-17 07:15:54 +00:00
alloc.rs Fix typos “a”→“an” 2021-08-22 15:35:11 +02:00
borrow.rs Added diagnostic items to structs and traits for Clippy 2021-07-15 23:57:02 +02:00
boxed.rs add Box::try_new_uninit_slice for symmetry 2021-08-05 21:21:52 +02:00
fmt.rs Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
lib.rs Constified Default implementations 2021-08-17 07:15:54 +00:00
macros.rs Remove alloc/malloc/calloc/realloc doc aliases 2021-06-30 19:59:39 +01:00
raw_vec.rs Fix a typo in raw_vec 2021-08-28 20:20:22 +02:00
rc.rs Rollup merge of #88226 - steffahn:an_rc, r=michaelwoerister 2021-08-25 15:48:53 +02:00
slice.rs Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
str.rs Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
string.rs Constified Default implementations 2021-08-17 07:15:54 +00:00
sync.rs Make explanations of cross-references between make_mut and get_mut more accurate 2021-08-24 21:34:12 +02:00
task.rs Document From implementations for Waker and RawWaker 2021-04-22 14:16:33 -07:00
tests.rs Fix alloc::test::test_show 2021-04-21 15:45:41 +02:00