Skip to content

Commit

Permalink
Cleanup. Changed HashMap's internal layout.
Browse files Browse the repository at this point in the history
* use of NonZero hashes
* refactoring
* correct explanation of the load factor
* better nomenclature
* 'probe distance' -> 'displacement'
  • Loading branch information
pczarn committed Apr 19, 2015
1 parent d86b6f6 commit 3f67ec1
Show file tree
Hide file tree
Showing 3 changed files with 749 additions and 971 deletions.
18 changes: 18 additions & 0 deletions src/libstd/collections/hash/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ fn grow_by_insertion(b: &mut Bencher) {
});
}

#[bench]
fn grow_by_insertion_large(b: &mut Bencher) {
use super::map::HashMap;

let mut m = HashMap::new();

for i in range_inclusive(1, 1000) {
m.insert(i, (String::new(), String::new()));
}

let mut k = 1001;

b.iter(|| {
m.insert(k, (String::new(), String::new()));
k += 1;
});
}

#[bench]
fn find_existing(b: &mut Bencher) {
use super::map::HashMap;
Expand Down
Loading

0 comments on commit 3f67ec1

Please sign in to comment.