Skip to content

Commit

Permalink
feat: add can_parse to benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Jul 11, 2024
1 parent e46e848 commit 05d780f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion bench/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,19 @@ pub fn parse_benchmark(c: &mut Criterion) {
group.finish();
}

criterion_group!(benches, parse_benchmark);
pub fn can_parse_benchmark(c: &mut Criterion) {
let mut group = c.benchmark_group("can_parse");
group.throughput(Throughput::Bytes(URLS.iter().map(|u| u.len() as u64).sum()));
group.bench_function("ada_url", |b| {
b.iter(|| {
URLS.iter().for_each(|url| {
let _ = ada_url::Url::can_parse(*black_box(url), None);
})
})
});
// TODO: Add `url` crate when it supports can_parse function.
group.finish();
}

criterion_group!(benches, parse_benchmark, can_parse_benchmark);
criterion_main!(benches);

0 comments on commit 05d780f

Please sign in to comment.