Skip to content

Commit 3f67ec1

Browse files
committed
Cleanup. Changed HashMap's internal layout.
* use of NonZero hashes * refactoring * correct explanation of the load factor * better nomenclature * 'probe distance' -> 'displacement'
1 parent d86b6f6 commit 3f67ec1

File tree

3 files changed

+749
-971
lines changed

3 files changed

+749
-971
lines changed

src/libstd/collections/hash/bench.rs

+18
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@ fn grow_by_insertion(b: &mut Bencher) {
5555
});
5656
}
5757

58+
#[bench]
59+
fn grow_by_insertion_large(b: &mut Bencher) {
60+
use super::map::HashMap;
61+
62+
let mut m = HashMap::new();
63+
64+
for i in range_inclusive(1, 1000) {
65+
m.insert(i, (String::new(), String::new()));
66+
}
67+
68+
let mut k = 1001;
69+
70+
b.iter(|| {
71+
m.insert(k, (String::new(), String::new()));
72+
k += 1;
73+
});
74+
}
75+
5876
#[bench]
5977
fn find_existing(b: &mut Bencher) {
6078
use super::map::HashMap;

0 commit comments

Comments
 (0)