-
Notifications
You must be signed in to change notification settings - Fork 60
Add grapheme iteration benchmarks for various languages. #78
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
Conversation
Here are the cleaned up benchmarks. They aren't quite the same as the ones I used in #77:
I wasn't totally sure how best to exclude the benches folder from publishing. Simply adding it to the exclude list actually causes packaging to fail, since its referenced by the |
Also, just to be clear: the benchmarks don't compile without the text files present. So I'm a bit nervous about this approach for excluding the benchmark texts from publishing. I'm not sure if there's any infrastructure that might not like that. |
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.
This looks great! Can we mention the license for these files? It's CC-BY-SA so we need to mention the license and attribute it.
benches/graphemes.rs
Outdated
|
||
fn graphemes_english(bench: &mut Bencher) { | ||
bench.iter(|| { | ||
for g in UnicodeSegmentation::graphemes(TEXT_ENGLISH, true) { |
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.
the text itself should also pass through black_box
. Probably doesn't matter given how large it is, but worth a shot.
Alternatively, we can load the file dynamically outside of the iter()
call.
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.
Pushed a fix that does this.
We've had complaints about tests that break when run from published code, but this is usually packagers ensuring that their packaging went correctly. I don't think we'll have the same issue for benches. However, my understanding is that you don't need a |
Oh, nope, it's necessary because you're using a custom harness. Darn. |
Anyway, the benches will now compile, just not run if run from the package. |
Pushed in some commits adding a license/attribution and making the benchmarks use files. Thanks for doing this! |
Awesome, thanks for cleaning this up! Out of curiosity, is there a way to do benchmarks in rust without a custom harness? My understanding was that the standard benchmarker isn't stable, so you always need a custom harness. If that's not the case, I'd be more than happy to change the benchmarker that's used. |
I didn't know that you can use custom harnesses this way on stable! Yes, the default harness isn't stable, but most people just set up their CI to bench on nightly only. shrug |
Grapheme iteration benchmarks for Arabic, English, Hindi, Japanese, Korean, Mandarin Chinese, Russian, and C source code.