Skip to content

Commit 2846702

Browse files
committed
Add two bench targets
1 parent d3c9377 commit 2846702

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

bench/benches/bench.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,26 @@ fn bench_top100(c: &mut Criterion) {
219219
})
220220
});
221221
group.finish();
222+
223+
let mut group = c.benchmark_group("parse-iri-normalize-top100");
224+
group.throughput(Throughput::Elements(lines.len() as u64));
225+
group.bench_function("fluent-uri", |b| {
226+
b.iter(|| {
227+
for &line in &lines {
228+
if let Ok(iri) = Iri::parse(line) {
229+
black_box(iri.normalize());
230+
}
231+
}
232+
})
233+
});
234+
group.bench_function("iri-string", |b| {
235+
b.iter(|| {
236+
for &line in &lines {
237+
if let Ok(iri) = IriStr::new(line) {
238+
black_box(iri.normalize().to_dedicated_string());
239+
}
240+
}
241+
})
242+
});
243+
group.finish();
222244
}

bench/result.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,8 @@ parse-normalize-top100/url
3737
time: [41.405 ms 41.605 ms 41.824 ms]
3838
parse-normalize-top100/ada-url
3939
time: [17.195 ms 17.329 ms 17.473 ms]
40+
41+
parse-iri-normalize-top100/fluent-uri
42+
time: [27.661 ms 27.769 ms 27.888 ms]
43+
parse-iri-normalize-top100/iri-string
44+
time: [108.81 ms 109.26 ms 109.74 ms]

0 commit comments

Comments
 (0)