Skip to content

Commit

Permalink
add throughput to benchmarks, fix double count of 1000
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Bogus committed Aug 22, 2023
1 parent e86d99d commit ff36415
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ fn random_bytes(len: usize) -> Vec<u8> {

static COUNTS: &[usize] = &[
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 170, 210, 250, 300, 400, 500, 600, 700,
800, 900, 1000, 1_000, 1_200, 1_400, 1_700, 2_100, 2_500, 3_000, 4_000, 5_000, 6_000, 7_000,
8_000, 9_000, 10_000, 12_000, 14_000, 17_000, 21_000, 25_000, 30_000, 100_000, 1_000_000,
800, 900, 1_000, 1_200, 1_400, 1_700, 2_100, 2_500, 3_000, 4_000, 5_000, 6_000, 7_000, 8_000,
9_000, 10_000, 12_000, 14_000, 17_000, 21_000, 25_000, 30_000, 100_000, 1_000_000,
];

fn get_counts() -> Vec<usize> {
Expand Down Expand Up @@ -60,6 +60,7 @@ fn bench_counts(criterion: &mut Criterion) {
let counts = get_counts();
let mut group = criterion.benchmark_group("counts");
for count in counts {
group.throughput(criterion::Throughput::Bytes(count as u64));
group.bench_with_input(BenchmarkId::new("naive", count), &count, naive);
group.bench_with_input(BenchmarkId::new("naive_32", count), &count, naive_32);
group.bench_with_input(BenchmarkId::new("hyper", count), &count, hyper);
Expand All @@ -78,6 +79,7 @@ fn bench_num_chars(criterion: &mut Criterion) {
let counts = get_counts();
let mut group = criterion.benchmark_group("num_chars");
for count in counts {
group.throughput(criterion::Throughput::Bytes(count as u64));
group.bench_with_input(BenchmarkId::new("naive", count), &count, naive);
group.bench_with_input(BenchmarkId::new("hyper", count), &count, hyper);
}
Expand Down

0 comments on commit ff36415

Please sign in to comment.