]> git.lizzy.rs Git - rust.git/commit
BTreeMap::from_iter: use bulk building to improve the performance
authorCheng XU <git@xuc.me>
Sat, 28 Aug 2021 23:48:45 +0000 (16:48 -0700)
committerCheng XU <git@xuc.me>
Sun, 29 Aug 2021 00:18:50 +0000 (17:18 -0700)
commitcf814d60f82723e5965763859c51b3e7bd885b9b
tree3076d1accc7df88f4ad350dc57d8fea3ccdd1f43
parent6a6885c6bd1d44969ced14ab7f3ea9d543bf14a2
BTreeMap::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.
library/alloc/src/collections/btree/dedup_sorted_iter.rs [new file with mode: 0644]
library/alloc/src/collections/btree/map.rs
library/alloc/src/collections/btree/mod.rs