mirror of
https://github.com/crate-ci/typos.git
synced 2025-01-11 01:01:36 -05:00
commit
969f4f88be
2 changed files with 19 additions and 2 deletions
|
@ -6,14 +6,31 @@ fn bench_tokenize(c: &mut Criterion) {
|
||||||
let mut group = c.benchmark_group("tokenize");
|
let mut group = c.benchmark_group("tokenize");
|
||||||
for (name, sample) in data::DATA {
|
for (name, sample) in data::DATA {
|
||||||
let len = sample.len();
|
let len = sample.len();
|
||||||
group.bench_with_input(BenchmarkId::new("ident", name), &len, |b, _| {
|
group.bench_with_input(BenchmarkId::new("ident(bytes)", name), &len, |b, _| {
|
||||||
let parser = typos::tokens::Tokenizer::new();
|
let parser = typos::tokens::Tokenizer::new();
|
||||||
b.iter(|| parser.parse_bytes(sample.as_bytes()).last());
|
b.iter(|| parser.parse_bytes(sample.as_bytes()).last());
|
||||||
});
|
});
|
||||||
|
group.bench_with_input(BenchmarkId::new("ident(str)", name), &len, |b, _| {
|
||||||
|
let parser = typos::tokens::Tokenizer::new();
|
||||||
|
b.iter(|| parser.parse_str(sample).last());
|
||||||
|
});
|
||||||
group.bench_with_input(BenchmarkId::new("words", name), &len, |b, _| {
|
group.bench_with_input(BenchmarkId::new("words", name), &len, |b, _| {
|
||||||
let symbol = typos::tokens::Identifier::new_unchecked(sample, 0);
|
let symbol = typos::tokens::Identifier::new_unchecked(sample, 0);
|
||||||
b.iter(|| symbol.split().last());
|
b.iter(|| symbol.split().last());
|
||||||
});
|
});
|
||||||
|
group.bench_with_input(
|
||||||
|
BenchmarkId::new("ident(bytes)+words", name),
|
||||||
|
&len,
|
||||||
|
|b, _| {
|
||||||
|
let parser = typos::tokens::Tokenizer::new();
|
||||||
|
b.iter(|| {
|
||||||
|
parser
|
||||||
|
.parse_bytes(sample.as_bytes())
|
||||||
|
.flat_map(|i| i.split())
|
||||||
|
.last()
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
group.finish();
|
group.finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
pre-release-commit-message = "chore({{crate_name}}): Release {{version}}"
|
pre-release-commit-message = "chore: Release"
|
||||||
no-dev-version = true
|
no-dev-version = true
|
||||||
tag-message = "{{tag_name}}"
|
tag-message = "{{tag_name}}"
|
||||||
tag-name = "{{prefix}}v{{version}}"
|
tag-name = "{{prefix}}v{{version}}"
|
||||||
|
|
Loading…
Reference in a new issue