forked from denoland/rust-urlpattern
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse_patterns.rs
More file actions
23 lines (21 loc) · 751 Bytes
/
parse_patterns.rs
File metadata and controls
23 lines (21 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use criterion::{Criterion, black_box, criterion_group, criterion_main};
use urlpattern::quirks::{self, EcmaRegexp};
fn bench_parse_shipping_groups_summary(c: &mut Criterion) {
c.bench_function("parse component-ShippingGroupsSummary.*.js", |b| {
b.iter(|| {
let input = quirks::process_construct_pattern_input(
black_box(quirks::StringOrInit::String(
"component-ShippingGroupsSummary.*.js".into(),
)),
black_box(Some("https://example.test/web/")),
);
quirks::parse_pattern::<EcmaRegexp>(
input.unwrap(),
urlpattern::UrlPatternOptions::default(),
)
.unwrap();
})
});
}
criterion_group!(benches, bench_parse_shipping_groups_summary);
criterion_main!(benches);