Skip to content

Commit ff36415

Browse files
author
Andre Bogus
committed
add throughput to benchmarks, fix double count of 1000
1 parent e86d99d commit ff36415

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

benches/bench.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ fn random_bytes(len: usize) -> Vec<u8> {
1818

1919
static COUNTS: &[usize] = &[
2020
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 170, 210, 250, 300, 400, 500, 600, 700,
21-
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,
22-
8_000, 9_000, 10_000, 12_000, 14_000, 17_000, 21_000, 25_000, 30_000, 100_000, 1_000_000,
21+
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,
22+
9_000, 10_000, 12_000, 14_000, 17_000, 21_000, 25_000, 30_000, 100_000, 1_000_000,
2323
];
2424

2525
fn get_counts() -> Vec<usize> {
@@ -60,6 +60,7 @@ fn bench_counts(criterion: &mut Criterion) {
6060
let counts = get_counts();
6161
let mut group = criterion.benchmark_group("counts");
6262
for count in counts {
63+
group.throughput(criterion::Throughput::Bytes(count as u64));
6364
group.bench_with_input(BenchmarkId::new("naive", count), &count, naive);
6465
group.bench_with_input(BenchmarkId::new("naive_32", count), &count, naive_32);
6566
group.bench_with_input(BenchmarkId::new("hyper", count), &count, hyper);
@@ -78,6 +79,7 @@ fn bench_num_chars(criterion: &mut Criterion) {
7879
let counts = get_counts();
7980
let mut group = criterion.benchmark_group("num_chars");
8081
for count in counts {
82+
group.throughput(criterion::Throughput::Bytes(count as u64));
8183
group.bench_with_input(BenchmarkId::new("naive", count), &count, naive);
8284
group.bench_with_input(BenchmarkId::new("hyper", count), &count, hyper);
8385
}

0 commit comments

Comments
 (0)