ratatui-org / ratatui

Rust library that's all about cooking up terminal user interfaces (TUIs) 👨‍🍳🐀
https://ratatui.rs
MIT License
8.86k stars 269 forks source link

build(bench): improve benchmark consistency #1126

Closed EdJoPaTo closed 1 month ago

EdJoPaTo commented 1 month ago

Codegen units are optimized on their own. Per default bench / release have 16 codegen units. What ends up in a codeget unit is rather random and can influence a benchmark result as a code change can move stuff into a different codegen unit → prevent / allow LLVM optimizations unrelated to the actual change.

More details: https://doc.rust-lang.org/cargo/reference/profiles.html

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.3%. Comparing base (fadc73d) to head (0416315). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1126 +/- ## ======================================= - Coverage 94.3% 94.3% -0.1% ======================================= Files 61 61 Lines 14768 14776 +8 ======================================= Hits 13935 13935 - Misses 833 841 +8 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

EdJoPaTo commented 1 month ago

Can you link to a doc for this to make it easier to understand why this improves the consistency for a later reader of the cargo.toml?

I updated the PR description with a link to the profile options. But a reader probably needs to read more into codegen units and lto so not sure whether there is a great link to add here. Personally I would check for the Commit / PR that added it to find more details… But that isnt perfect either.

joshka commented 1 month ago

Can you link to a doc for this to make it easier to understand why this improves the consistency for a later reader of the cargo.toml?

I updated the PR description with a link to the profile options. But a reader probably needs to read more into codegen units and lto so not sure whether there is a great link to add here. Personally I would check for the Commit / PR that added it to find more details… But that isnt perfect either.

Generally I like to have non-obvious things explained right in front of my face and not have to guess where to look for docs. A comment in a commit won't survive reformatting that hits the line being commented. Is there some extra doc you can link to that documents the impact of codegen-units / lto on the benchmark tooling? The best I've found is perhaps https://nnethercote.github.io/perf-book/build-configuration.html#maximizing-runtime-speed

EdJoPaTo commented 1 month ago

A comment in a commit won't survive reformatting that hits the line being commented.

git blame is my friend ;)

Is there some extra doc you can link to that documents the impact of codegen-units / lto on the benchmark tooling? The best I've found is […]

I would prefer to stick to official Rust documentation when possible as it will be kept more likely up to date / available. The profile stuff isn't that bad as it continues to link further and is exactly what is changed/configured here. It's not perfect but a starting point?