bench in-place collect of droppables
This commit is contained in:
parent
8ac96e6a98
commit
a9c78e371e
1 changed files with 15 additions and 0 deletions
|
@ -501,6 +501,21 @@ fn bench_in_place_recycle(b: &mut test::Bencher) {
|
|||
});
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct Droppable(usize);
|
||||
|
||||
impl Drop for Droppable {
|
||||
fn drop(&mut self) {
|
||||
black_box(self);
|
||||
}
|
||||
}
|
||||
|
||||
#[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<_>>())
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_chain_collect(b: &mut test::Bencher) {
|
||||
let data = black_box([0; LEN]);
|
||||
|
|
Loading…
Add table
Reference in a new issue