Skip to content

Commit

Permalink
bench: Only output throughput if BYTES is set (#56)
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Hoffmann <[email protected]>
  • Loading branch information
antiguru authored Jul 8, 2024
1 parent ebec264 commit 2741da1
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ fn vec_u_vn_s_copy_flat_region_column(bencher: &mut Bencher) {
);
}

fn set_bytes(target: &mut u64, bytes: usize) {
if std::env::var("BYTES").is_ok() {
*target = bytes as u64;
}
}

fn _bench_copy<T: RegionPreference + Eq>(bencher: &mut Bencher, record: T)
where
for<'a> <T as RegionPreference>::Region: Push<&'a T>,
Expand All @@ -399,8 +405,7 @@ where
siz += this_siz;
cap += this_cap
});
bencher.bytes = siz as u64;
println!("{siz} {cap}");
set_bytes(&mut bencher.bytes, siz);
}

fn _bench_copy_region<R: Region, T>(bencher: &mut Bencher, record: T)
Expand All @@ -421,8 +426,7 @@ where
siz += this_siz;
cap += this_cap
});
bencher.bytes = siz as u64;
println!("{siz} {cap}");
set_bytes(&mut bencher.bytes, siz);
}

fn _bench_clone<T: RegionPreference + Eq + Clone>(bencher: &mut Bencher, record: T) {
Expand Down Expand Up @@ -454,7 +458,6 @@ where
siz += this_siz;
cap += this_cap
});
bencher.bytes = siz as u64;
}

fn _bench_prealloc<T: RegionPreference + Eq>(bencher: &mut Bencher, record: T)
Expand All @@ -475,7 +478,7 @@ where
siz += this_siz;
cap += this_cap
});
bencher.bytes = siz as u64;
set_bytes(&mut bencher.bytes, siz);
}

fn _bench_copy_flat_preference<T>(bencher: &mut Bencher, record: T)
Expand Down Expand Up @@ -506,6 +509,5 @@ where
siz += this_siz;
cap += this_cap
});
bencher.bytes = siz as u64;
println!("{siz} {cap}");
set_bytes(&mut bencher.bytes, siz);
}

0 comments on commit 2741da1

Please sign in to comment.