Skip to content

Commit 9024a15

Browse files
committed
update benchmarks
1 parent 761976e commit 9024a15

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ categories = ["text-processing", "web-programming"]
1313

1414
[dev-dependencies]
1515
idna = "1.0"
16-
criterion = "0.5"
16+
criterion = { version = "0.5.1", features = ["html_reports"] }
1717
serde = { version = "1", features = ["derive"] }
1818
serde_json = "1"
1919

benches/idna_comparison.rs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use criterion::{Criterion, black_box, criterion_group, criterion_main};
2+
use std::time::Duration;
23

34
fn benchmark_to_ascii_ada_vs_idna(c: &mut Criterion) {
45
let test_domains = vec![
@@ -257,13 +258,26 @@ fn benchmark_single_domain_performance(c: &mut Criterion) {
257258
}
258259
}
259260

260-
criterion_group!(
261-
benches,
262-
benchmark_to_ascii_ada_vs_idna,
263-
benchmark_to_unicode_ada_vs_idna,
264-
benchmark_punycode_encoding,
265-
benchmark_punycode_decoding,
266-
benchmark_unicode_normalization,
267-
benchmark_single_domain_performance,
268-
);
261+
fn configure_criterion() -> Criterion {
262+
Criterion::default()
263+
.sample_size(150)
264+
.measurement_time(Duration::from_secs(15))
265+
.warm_up_time(Duration::from_secs(5))
266+
.nresamples(300_000)
267+
.noise_threshold(0.005)
268+
.significance_level(0.01)
269+
.confidence_level(0.99)
270+
}
271+
272+
criterion_group! {
273+
name = benches;
274+
config = configure_criterion();
275+
targets =
276+
benchmark_to_ascii_ada_vs_idna,
277+
benchmark_to_unicode_ada_vs_idna,
278+
benchmark_punycode_encoding,
279+
benchmark_punycode_decoding,
280+
benchmark_unicode_normalization,
281+
benchmark_single_domain_performance,
282+
}
269283
criterion_main!(benches);

0 commit comments

Comments
 (0)