|
1 | 1 | use criterion::{Criterion, black_box, criterion_group, criterion_main}; |
| 2 | +use std::time::Duration; |
2 | 3 |
|
3 | 4 | fn benchmark_to_ascii_ada_vs_idna(c: &mut Criterion) { |
4 | 5 | let test_domains = vec![ |
@@ -257,13 +258,26 @@ fn benchmark_single_domain_performance(c: &mut Criterion) { |
257 | 258 | } |
258 | 259 | } |
259 | 260 |
|
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 | +} |
269 | 283 | criterion_main!(benches); |
0 commit comments