зеркало из https://github.com/mozilla/gecko-dev.git
19 строки
340 B
Rust
19 строки
340 B
Rust
#[macro_use]
|
|
extern crate bencher;
|
|
|
|
extern crate url;
|
|
|
|
use bencher::{black_box, Bencher};
|
|
|
|
use url::Url;
|
|
|
|
fn short(bench: &mut Bencher) {
|
|
let url = "https://example.com/bench";
|
|
|
|
bench.bytes = url.len() as u64;
|
|
bench.iter(|| black_box(url).parse::<Url>().unwrap());
|
|
}
|
|
|
|
benchmark_group!(benches, short);
|
|
benchmark_main!(benches);
|