exercise more of the in-place pipeline in the bench

This commit is contained in:
The8472 2019-11-21 01:01:35 +01:00
parent a9c78e371e
commit a596ff36b5

View file

@ -513,7 +513,14 @@ impl Drop for Droppable {
#[bench]
fn bench_in_place_collect_droppable(b: &mut test::Bencher) {
let v: Vec<Droppable> = std::iter::repeat_with(|| Droppable(0)).take(1000).collect();
b.iter(|| v.clone().into_iter().skip(100).collect::<Vec<_>>())
b.iter(|| {
v.clone()
.into_iter()
.skip(100)
.enumerate()
.map(|(i, e)| Droppable(i ^ e.0))
.collect::<Vec<_>>()
})
}
#[bench]