- Notifications
You must be signed in to change notification settings - Fork65
Add ascii fast path for unicode_word_indices and unicode_words#147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
13 commits Select commitHold shift + click to select a range
592d99d add benchmark
PSeitz-ddeca9043 add ascii fastpath
PSeitz-ddb5ed407 add test case IP
PSeitz-dd9b1b7f9 add log to benches
PSeitz-dd6f96a23 restore iterators
PSeitz-dd7beb8a6 add backwards iterator
PSeitz-dda3881da restore test
PSeitz-dd7599d62 replace Box with Enum
PSeitz-dde29c432 add comments with reference to the spec
PSeitz-dd5a09f28 remove unused alloc
PSeitz-ddf76a997 readd Debug derive
PSeitz-ddb556333 use import
PSeitz-dd0e7674a remove pub
PSeitz-ddFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
6 changes: 6 additions & 0 deletionsCargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletionsbenches/chars.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletionsbenches/texts/log.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 2018-07-12 13:59:01 UTC | ERROR | (worker.go:131 in process) | Too many errors for endpoint 'dummy/api/v1/check_run?api_key=*************************00000': retrying later |
37 changes: 37 additions & 0 deletionsbenches/unicode_word_indices.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; | ||
| use std::fs; | ||
| use unicode_segmentation::UnicodeSegmentation; | ||
| const FILES: &[&str] = &[ | ||
| "log", //"arabic", | ||
| "english", | ||
| //"hindi", | ||
| "japanese", | ||
| //"korean", | ||
| //"mandarin", | ||
| //"russian", | ||
| //"source_code", | ||
| ]; | ||
| #[inline(always)] | ||
| fn grapheme(text: &str) { | ||
| for w in text.unicode_word_indices() { | ||
| black_box(w); | ||
| } | ||
| } | ||
| fn bench_all(c: &mut Criterion) { | ||
| let mut group = c.benchmark_group("unicode_word_indices"); | ||
| for file in FILES { | ||
| let input = fs::read_to_string(format!("benches/texts/{file}.txt")).unwrap(); | ||
| group.throughput(criterion::Throughput::Bytes(input.len() as u64)); | ||
| group.bench_with_input(BenchmarkId::from_parameter(file), &input, |b, content| { | ||
| b.iter(|| grapheme(content)) | ||
| }); | ||
| } | ||
| } | ||
| criterion_group!(benches, bench_all); | ||
| criterion_main!(benches); |
2 changes: 1 addition & 1 deletionbenches/word_bounds.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletionsbenches/words.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
21 changes: 13 additions & 8 deletionssrc/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.