-
Notifications
You must be signed in to change notification settings - Fork 14
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
docs: Update performance.md #188
base: master
Are you sure you want to change the base?
Conversation
zamazan4ik
commented
Oct 2, 2024
- add documentation about PGO usage for optimizing Rinja's performance. As was asked in https://www.reddit.com/r/rust/comments/1ftx5iv/comment/lpy5v01/
- add documentation about PGO usage for optimizing Rinja's performance
|
||
## Profile-Guided Optimization (PGO) | ||
|
||
To optimize Rinja's performance, you can compile your application with [Profile-Guided Optimization](https://doc.rust-lang.org/rustc/profile-guided-optimization.html). According to the [tests](https://github.com/mitsuhiko/minijinja/pull/588#issuecomment-2387957123), PGO can improve the library performance by 15%. |
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 write rinja
in lowercase so please update. :)
Could you also explain in the book directly instead of linking to a github issue? The explanations there are great so I think you can mostly copy-paste it as is.
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 write rinja in lowercase so please update. :)
Sorry - I just copied it from line 30th "... Rinja's derive macros" ;)
Could you also explain in the book directly instead of linking to a github issue? The explanations there are great so I think you can mostly copy-paste it as is.
Sure. Which details should be copied from the GitHub issue to the book? Just asking because I am sure that you don't need all the details (like my test env). Better clarify upfront then rework multiple times.
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.
Anything needed to be able to use PGO. What you need to install etc.
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.
Instructions about how to use PGO for Rust programs are described in the official Rustc docs that I already linked to the docs: https://doc.rust-lang.org/rustc/profile-guided-optimization.html - it's an official instruction about how to implement PGO for Rust programs (including a note about about cargo-pgo
). My GitHub issue describes how to reproduce my benchmark results. I guessed that target users are not interested in reproducing my benchmarks but interested in optimizing their rinja
-based apps.
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.
So maybe just remove the GitHub link at all from the docs? :)
Interesting! @zamazan4ik, do you know if it's possible to see/evaluate the results of the profiling? If it is, then maybe we could add a few |
Well, it's possible to achieve via analyzing "before" vs "after" assembly LLVM IR and guessing the required changes (or extracting optimization feedback from LLVM). However, I highly recommend don't do it in practice since this way has many drawbacks:
So my personal recommendation is just leaving the things to PGO and spend your efforts to something more important to the projects like high-level/algortihm optimizations that still cannot be done by compilers (at least yet). |