Skip to content

Commit

Permalink
Add Japanese benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriansaliou committed Aug 12, 2023
1 parent 990e322 commit 12ea7e1
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,29 @@ mod benches {
});
}

#[bench]
fn bench_clean_token_english_hinted_build(b: &mut Bencher) {
b.iter(|| {
TokenLexerBuilder::from(
TokenLexerMode::NormalizeAndCleanup(Some(Lang::Eng)),
"The quick brown fox jumps over the lazy dog!",
)
});
}

#[bench]
fn bench_clean_token_english_hinted_exhaust(b: &mut Bencher) {
b.iter(|| {
let token_cleaner = TokenLexerBuilder::from(
TokenLexerMode::NormalizeAndCleanup(Some(Lang::Eng)),
"The quick brown fox jumps over the lazy dog!",
)
.unwrap();

token_cleaner.map(|value| value.1).collect::<Vec<u32>>()
});
}

#[bench]
fn bench_clean_token_chinese_build(b: &mut Bencher) {
b.iter(|| {
Expand All @@ -671,21 +694,21 @@ mod benches {
}

#[bench]
fn bench_clean_token_english_hinted_build(b: &mut Bencher) {
fn bench_clean_token_japanese_build(b: &mut Bencher) {
b.iter(|| {
TokenLexerBuilder::from(
TokenLexerMode::NormalizeAndCleanup(Some(Lang::Eng)),
"The quick brown fox jumps over the lazy dog!",
TokenLexerMode::NormalizeAndCleanup(None),
"関西国際空港限定トートバッグ",
)
});
}

#[bench]
fn bench_clean_token_english_hinted_exhaust(b: &mut Bencher) {
fn bench_clean_token_japanese_exhaust(b: &mut Bencher) {
b.iter(|| {
let token_cleaner = TokenLexerBuilder::from(
TokenLexerMode::NormalizeAndCleanup(Some(Lang::Eng)),
"The quick brown fox jumps over the lazy dog!",
TokenLexerMode::NormalizeAndCleanup(None),
"関西国際空港限定トートバッグ",
)
.unwrap();

Expand Down

0 comments on commit 12ea7e1

Please sign in to comment.