-
Notifications
You must be signed in to change notification settings - Fork 74
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
592d99d
add benchmark
PSeitz-dd eca9043
add ascii fastpath
PSeitz-dd b5ed407
add test case IP
PSeitz-dd 9b1b7f9
add log to benches
PSeitz-dd 6f96a23
restore iterators
PSeitz-dd 7beb8a6
add backwards iterator
PSeitz-dd a3881da
restore test
PSeitz-dd 7599d62
replace Box with Enum
PSeitz-dd e29c432
add comments with reference to the spec
PSeitz-dd 5a09f28
remove unused alloc
PSeitz-dd f76a997
readd Debug derive
PSeitz-dd b556333
use import
PSeitz-dd 0e7674a
remove pub
PSeitz-dd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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 |
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); |
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
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
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this change made?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, that shouldn't be there. That's left over from a reverted refactoring.