diff --git a/Cargo.toml b/Cargo.toml index 7387b38..25c8929 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "urlnorm" -version = "0.1.3" +version = "0.1.5" edition = "2021" description = "A URL normalization library for Rust" license = "Apache-2.0 OR MIT" diff --git a/benches/bench.rs b/benches/bench.rs index cc51b86..b1c6528 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -14,5 +14,22 @@ pub fn normalize_benchmark(c: &mut Criterion) { }); } -criterion_group!(benches, normalize_benchmark); +pub fn torture_test(c: &mut Criterion) { + let x = std::iter::repeat("A5.html") + .take(50000) + .collect::() + .to_owned(); + let mut url_input = "https://goooooooogle.com/hello/index.html/".to_owned(); + url_input.push_str(x.as_str()); + let url = Url::parse(&url_input).unwrap(); + + let norm = UrlNormalizer::default(); + c.bench_function("normalize url", |b| { + b.iter(|| { + norm.compute_normalization_string(&url); + }) + }); +} + +criterion_group!(benches, normalize_benchmark, torture_test); criterion_main!(benches);