- Notifications
You must be signed in to change notification settings - Fork 56
Parley Benchmarks #405
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
Parley Benchmarks #405
Conversation
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.
Looks good and runs for me. I get a roughly ± 2 % noise floor (comparing this branch to itself in Tango) when running with a pinned CPU and quieted IRQs on the thread... which is not too bad!
I settled on Divan recently for one of my things, because the less-sophisticated statistical analysis and research-driven sampling method helped a lot with certain types of micro benchmarks that were completely impossible to measure reliably with Criterion (due to a weird sampling behavior, or maybe Criterion was somehow poisoning the branch predictor for this particular function.. unsure).
Tango is very cool, I like the differential paired timing analysis, reminds me of balanced signal pairs/differential signalling. :+ )
DJMcNab left a comment
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.
There is one blocker, which is updating the file paths for the fonts in the root README (and also removing them from parley/README.md)
| | ||
| //! # Parley Bench Build Script | ||
| fn main() { |
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.
Presumably, this is the boilerplate required by Tango? We should probably comment that there
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.
Yup! Added in cf13c64
parley_bench/README.md Outdated
| @@ -0,0 +1,19 @@ | |||
| # Parley Benchmarks | |||
| | |||
| A suite of benchmarks used to evaluate Parley performance. | |||
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.
We should link to Tango somewhere here, so people have a chance to understand what's actually going on.
It looks like the right link is https://github.com/bazhenov/tango. Something like:
This uses [Tango](https://github.com/bazhenov/tango) to perform paired benchmarking.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.
I also just saw that Tango would require manual changes and nightly on Windows - we should also document that (even if it's just "Windows might require additional setup, see Tango's docs for details")
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.
Thank you! Added in 4d5a16b
| @@ -0,0 +1,11 @@ | |||
| # Sample Text Attribution | |||
| | |||
| All samples are licensed under the [Creative Commons Attribution-ShareAlike License](https://creativecommons.org/licenses/by-sa/4.0/) as copied to ./LICENSE. | |||
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.
Wikisource documents that Moby Dick is in the public domain (see the note at the bottom of https://en.wikisource.org/wiki/Moby-Dick_(1851)_US_edition).
It does the same for the Tosa Diary source - if you see the note at the bottom of that source, it states that it's in the public domain in the US. We are already relying on this public domain status for them to be licensed under the license which we claim, and I believe that the intention of Wikisource's license is to cover all the copyrightable content (e.g. the intro at the top of the Moby Dick page).
The situation for Al-Kindi - First Philosophy is slightly less clear, but given that the texts were written more than 1000 years ago, I imagine the situation is similar. I've not found any sources which discuss this (in English).
As such, I think we have two pathways here:
- We can either just use them without copying in the license, still mentioning that we got them from Wikisource. Since they are in the public domain. This is the direction I'd choose, if you agree with my analysis.
- Use this form, which also requires us to mention that these files are licensed as discussed in the root README. That is, this is a step which hasn't been done in this PR; the text at https://github.com/linebender/parley?tab=readme-ov-file#license would need to be updated.
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.
Yes, I agree with your assessment. I've made this change in e5f2e46
| #[derive(Debug)] | ||
| pub struct Sample { | ||
| /// The name of the sample. | ||
| pub name: &'static str, |
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.
I'd be tempted to also add a "title" field here, although I'm not sure where we'd use it.
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.
Added in 385e49c
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.
As this file has moved, it's reference in the root README needs to be updated. This is blocking
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.
Nice catch! Thank you - fixed in 711c011
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.
I'd like for this folder to have a README. It should have an intro:
Data and fonts used in Parley's tests and benchmarks.and something like:
Some files included in this folder are under different licenses to the rest of this workspace: - The font file `Arimo-VariableFont_wght.ttf` in `./assets/arimo_fonts/` is licensed solely as documented in that folder (and is licensed under the Apache License, Version 2.0). - The font file `Roboto-Regular.ttf` in `./assets/roboto_fonts/` is licensed solely as documented in that folder (and is licensed under the Apache License, Version 2.0). - The font file `NotoKufiArabic-Regular.otf` in `./assets/noto_fonts/` is licensed solely as documented in that folder (and is licensed under the SIL Open Font License, Version 1.1). 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.
Great idea - implemented in 711c011
| By the way, when I spoke to Denis at RustWeek, they mentioned that they have had some success using this technique on GitHub's CI runners (~10% noise floor). It could be worth experimenting with automatically running some of these benchmarks, and somehow reporting results (they need only be used as a signal to trigger manual benchmarking) |
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
…ajp/microbenchmarks
DJMcNab left a comment
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 most important suggestion here is updating the content of the Parley package's README. Approving if and only if that's fixed (to clarify, this is because the file mentioned in the "License" section is no longer a descendent of that folder).
| | ||
| | Sample | Title | Amendments | Source | | ||
| | ----------------- | ---------------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `./arabic.txt` | Al-Kindi - First Philosophy | None | [Wiki Source](https://ar.wikisource.org/wiki/%D8%A7%D9%84%D9%83%D9%86%D8%AF%D9%8A_-_%D8%A7%D9%84%D9%81%D9%84%D8%B3%D9%81%D8%A9_%D8%A7%D9%84%D8%A3%D9%88%D9%84%D9%89) | |
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.
Maximum nit: Wikisource tends to be stylised "Wikisource" instead of "Wiki Source". This is non-blocking
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.
Removed in ca1845a
| - The font file `Arimo-VariableFont_wght.ttf` in `/parley/tests/assets/arimo_fonts/` is licensed solely as documented in that folder (and is licensed under the Apache License, Version 2.0). | ||
| - The font file `Roboto-Regular.ttf` in `/parley/tests/assets/roboto_fonts/` is licensed solely as documented in that folder (and is licensed under the Apache License, Version 2.0). | ||
| - The font file `NotoKufiArabic-Regular.otf` in `/parley/tests/assets/noto_fonts/` is licensed solely as documented in that folder (and is licensed under the SIL Open Font License, Version 1.1). | ||
| Some files used for tests and benchmarks are under different licenses. See `./parley_dev/README.md` for details. |
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 still needs to be reflected in ./parley/README.md (i.e. the "Some files used for tests are under different licenses:" section can just be removed).
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.
🤦 - Thanks for this catch. Removed in 2e61fa6
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
…ajp/microbenchmarks
Was removed in linebender#405
Was removed in #405
One thing I've noticed is that the Github arm runners (not sure how long they are offering these specific ones for public open source repos but) have lower variance, and are faster than their cheap public x86 runners. Here are two equivalent benchmarks (same code, one is a squashed version of the other): https://github.com/xorgy/joto/actions/runs/17196848204/job/48780185572#step:5:46 10% is about right I think. It is good for a sanity check. I noticed that regardless of whether I'm using criterion, tango, or divan, LTO and constraining the codegen units have helped make results more useful. (seems to lead to more similar layouts between builds, even when the implementation changes, but just because I see that in the disassembly doesn't mean it's why I see more consistency). Only catch for LTO is that applying it to any bench built with these requires nightly for a number of fun reasons. It'd be very cool if somebody somewhere was working on a port of the Stabilizer technique to Rust. :+ ) |
Caches HarfRust `ShapeData`, `ShaperInstance`, and `ShapePlan`s using an LRU inspired by Swash's implementation. Using #405 to measure, the performance improvement is very good. <img width="653" height="279" alt="out" src="https://github.com/user-attachments/assets/d157bb9c-e063-44e2-85be-afea7b242778" /> cc @conor-93
Adds in an initial set of benchmarks to aid Parley development.
I've opted to use Tango because I like the quick development loop. We can run 20 benchmark cases in ~10 seconds. It also "feels" more reliable.
Here's what its output looks like (results from an upcoming caching PR).
Extra
parley_devparley_dev/assets/text_samplescc @conor-93