Chris Morgan
›
Git
›
anymap
› blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
commit
grep
author
committer
pickaxe
?
search:
re
Try to drown a little bit of noise in benchmarks.
[anymap]
/
src
/
lib.rs
diff --git
a/src/lib.rs
b/src/lib.rs
index 8340ae247de0286b5386701859e27ee0ee80375a..01297b8c8e8dba517764fe670ff615475b0e6fe5 100644
(file)
--- a/
src/lib.rs
+++ b/
src/lib.rs
@@
-148,7
+148,9
@@
impl AnyMap {
fn bench_insertion(b: &mut ::test::Bencher) {
b.iter(|| {
let mut data = AnyMap::new();
fn bench_insertion(b: &mut ::test::Bencher) {
b.iter(|| {
let mut data = AnyMap::new();
- data.insert(42i);
+ for _ in range(0, 100) {
+ data.insert(42i);
+ }
})
}
})
}
@@
-156,7
+158,9
@@
fn bench_insertion(b: &mut ::test::Bencher) {
fn bench_find_missing(b: &mut ::test::Bencher) {
b.iter(|| {
let data = AnyMap::new();
fn bench_find_missing(b: &mut ::test::Bencher) {
b.iter(|| {
let data = AnyMap::new();
- assert_eq!(data.find(), None::<&int>);
+ for _ in range(0, 100) {
+ assert_eq!(data.find(), None::<&int>);
+ }
})
}
})
}
@@
-165,6
+169,9
@@
fn bench_find_present(b: &mut ::test::Bencher) {
b.iter(|| {
let mut data = AnyMap::new();
data.insert(42i);
b.iter(|| {
let mut data = AnyMap::new();
data.insert(42i);
- assert_eq!(data.find(), Some(&42i));
+ // These inner loops are a feeble attempt to drown the other factors.
+ for _ in range(0, 100) {
+ assert_eq!(data.find(), Some(&42i));
+ }
})
}
})
}