Skip to content

Commit d64103a

Browse files
committed
Show throughput in bytes
1 parent f95e9ca commit d64103a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

bench/benches/bench.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,10 @@ const TOP100_PATH: &str = concat!(
155155
fn bench_top100(c: &mut Criterion) {
156156
let top100 = fs::read_to_string(TOP100_PATH).unwrap();
157157
let lines = top100.lines().collect::<Vec<&str>>();
158+
let total_bytes = lines.iter().map(|s| s.len() as u64).sum();
158159

159160
let mut group = c.benchmark_group("parse-top100");
160-
group.throughput(Throughput::Elements(lines.len() as u64));
161+
group.throughput(Throughput::Bytes(total_bytes));
161162
group.bench_function("fluent-uri", |b| {
162163
b.iter(|| {
163164
for &line in &lines {
@@ -182,7 +183,7 @@ fn bench_top100(c: &mut Criterion) {
182183
group.finish();
183184

184185
let mut group = c.benchmark_group("parse-iri-top100");
185-
group.throughput(Throughput::Elements(lines.len() as u64));
186+
group.throughput(Throughput::Bytes(total_bytes));
186187
group.bench_function("fluent-uri", |b| {
187188
b.iter(|| {
188189
for &line in &lines {
@@ -214,7 +215,7 @@ fn bench_top100(c: &mut Criterion) {
214215
group.finish();
215216

216217
let mut group = c.benchmark_group("parse-normalize-top100");
217-
group.throughput(Throughput::Elements(lines.len() as u64));
218+
group.throughput(Throughput::Bytes(total_bytes));
218219
group.bench_function("fluent-uri", |b| {
219220
b.iter(|| {
220221
for &line in &lines {
@@ -250,7 +251,7 @@ fn bench_top100(c: &mut Criterion) {
250251
group.finish();
251252

252253
let mut group = c.benchmark_group("parse-iri-normalize-top100");
253-
group.throughput(Throughput::Elements(lines.len() as u64));
254+
group.throughput(Throughput::Bytes(total_bytes));
254255
group.bench_function("fluent-uri", |b| {
255256
b.iter(|| {
256257
for &line in &lines {

0 commit comments

Comments
 (0)