std: add benchmark for vec.mut_iter.

This commit is contained in:
Huon Wilson 2013-08-03 00:23:05 +10:00 committed by Daniel Micay
parent fbb7cd32c3
commit 1992765dd3

View File

@ -3595,4 +3595,17 @@ fn iterator(bh: &mut BenchHarness) {
if sum == 0 {fail!()}
}
}
#[bench]
fn mut_iterator(bh: &mut BenchHarness) {
let mut v = vec::from_elem(100, 0);
do bh.iter {
let mut i = 0;
foreach x in v.mut_iter() {
*x = i;
i += 1;
}
}
}
}