Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Manishearth merged 3 commits intounicode-rs:masterfromcessen:grapheme_bench
Feb 14, 2020
Merged

Add grapheme iteration benchmarks for various languages.#78

Manishearth merged 3 commits intounicode-rs:masterfromcessen:grapheme_bench
Feb 14, 2020

Conversation

cessen
Copy link
Contributor

@cessencessen commentedFeb 14, 2020
edited
Loading

Grapheme iteration benchmarks for Arabic, English, Hindi, Japanese, Korean, Mandarin Chinese, Russian, and C source code.

@cessen
Copy link
ContributorAuthor

Here are the cleaned up benchmarks. They aren'tquite the same as the ones I used in#77:

  • I basically re-built them to make extra sure all the text is from open-source/free-culture sources.
  • I took the time to source enough text to make most of the text unique, rather than a bunch of repeat copy-paste.
  • I reduced the text size to ~50kb each, as that seems like plenty.
  • I removed the zalgo and worst-case texts, as I don't think they're actually useful in practice and would likely just be confusing to people looking at the benchmarks in the future.

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[[bench]] section. So for now I only excludedbenches/texts, which contains the large text files. If I should do this differently, let me know!

@cessen
Copy link
ContributorAuthor

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.

Copy link
Member

@ManishearthManishearth left a 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.


fn graphemes_english(bench: &mut Bencher) {
bench.iter(|| {
for g in UnicodeSegmentation::graphemes(TEXT_ENGLISH, true) {
Copy link
Member

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 throughblack_box. Probably doesn't matter given how large it is, but worth a shot.

Alternatively, we can load the file dynamically outside of theiter() call.

Copy link
Member

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.

@Manishearth
Copy link
Member

We've had complaints abouttests 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[[bench]] entry if you just have abenches/ folderanyway, so we could totally just exclude it.

@Manishearth
Copy link
Member

Oh, nope, it's necessary because you're using a custom harness. Darn.

@Manishearth
Copy link
Member

Anyway, the benches will nowcompile, just not run if run from the package.

@ManishearthManishearth merged commit485767a intounicode-rs:masterFeb 14, 2020
@Manishearth
Copy link
Member

Pushed in some commits adding a license/attribution and making the benchmarks use files. Thanks for doing this!

@cessen
Copy link
ContributorAuthor

Awesome, thanks for cleaning this up!

Out of curiosity, is there a way to do benchmarks in rustwithout 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.

@cessencessen deleted the grapheme_bench branchFebruary 15, 2020 00:49
@Manishearth
Copy link
Member

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

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ManishearthManishearthManishearth approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@cessen@Manishearth

[8]ページ先頭

©2009-2025 Movatter.jp