Try to drown a little bit of noise in benchmarks.
This commit is contained in:
parent
8c1b4578cc
commit
cce7510089
|
@ -148,7 +148,9 @@ impl AnyMap {
|
||||||
fn bench_insertion(b: &mut ::test::Bencher) {
|
fn bench_insertion(b: &mut ::test::Bencher) {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let mut data = AnyMap::new();
|
let mut data = AnyMap::new();
|
||||||
|
for _ in range(0, 100) {
|
||||||
data.insert(42i);
|
data.insert(42i);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +158,9 @@ fn bench_insertion(b: &mut ::test::Bencher) {
|
||||||
fn bench_find_missing(b: &mut ::test::Bencher) {
|
fn bench_find_missing(b: &mut ::test::Bencher) {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let data = AnyMap::new();
|
let data = AnyMap::new();
|
||||||
|
for _ in range(0, 100) {
|
||||||
assert_eq!(data.find(), None::<&int>);
|
assert_eq!(data.find(), None::<&int>);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +169,9 @@ fn bench_find_present(b: &mut ::test::Bencher) {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let mut data = AnyMap::new();
|
let mut data = AnyMap::new();
|
||||||
data.insert(42i);
|
data.insert(42i);
|
||||||
|
// These inner loops are a feeble attempt to drown the other factors.
|
||||||
|
for _ in range(0, 100) {
|
||||||
assert_eq!(data.find(), Some(&42i));
|
assert_eq!(data.find(), Some(&42i));
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue