Rename crates
This commit is contained in:
29
crates/u-norm/benches/bench.rs
Normal file
29
crates/u-norm/benches/bench.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use std::fs;
|
||||
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
|
||||
use u_norm::nfd;
|
||||
use unicode_normalization::UnicodeNormalization;
|
||||
|
||||
const ASCII: &str = "all types of normalized";
|
||||
|
||||
fn criterion_benchmark(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("ASCII");
|
||||
|
||||
group.bench_function("unf", |b| b.iter(|| nfd(ASCII).count()));
|
||||
group.bench_function("unicode-normalization", |b| b.iter(|| ASCII.nfd().count()));
|
||||
|
||||
group.finish();
|
||||
|
||||
let long = fs::read_to_string("benches/long.txt").unwrap();
|
||||
|
||||
let mut group = c.benchmark_group("Long");
|
||||
|
||||
group.bench_function("unf", |b| b.iter(|| nfd(&long).count()));
|
||||
group.bench_function("unicode-normalization", |b| b.iter(|| long.nfd().count()));
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
criterion_group!(benches, criterion_benchmark);
|
||||
criterion_main!(benches);
|
||||
2366
crates/u-norm/benches/long.txt
Normal file
2366
crates/u-norm/benches/long.txt
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user