Rust article or tutorial idea…. optimizing with BOLT + LTO + PGO

Hello again,

Today I have read a news article that BOLT (Facebook/Meta project) has merged into LLVM code tree.
The BOLT + LTO + PGO combination gives a impressive performance uplift (34 % to 68.5 %) to many Clang (LLVM) and GCC compiled programs, see article. Including the Kernel, and even the Clang and GCC compilers execution.

  1. BOLT
  2. LTO – Link Time Optimization
  3. PGO – Profile Guided Optimization

Se the 2 following articles:

BOLT Merged Into LLVM To Optimize Binaries For Faster Performance
https://www.phoronix.com/scan.php?page=news_item&px=LLVM-Lands-BOLT

Facebook Has Been Working On BOLT'ing The Linux Kernel For Greater Performance
https://www.phoronix.com/scan.php?page=news_item&px=Facebook-BOLTing-The-Kernel

GitHub - BOLT
https://github.com/facebookincubator/BOLT/tree/main/bolt

It would be a really nice contribution to the Rust community, if someone that has the experience off using those 3 tools, decided to make a nice tutorial or practical article on how to apply it in Rust the combination of BOLT + LTO + PGO, with a nice example and all the installation process.

Thank you.

Best regards,
João

1 Like

If this BOLT thing indeed landed in upstream LLVM, then it will be available whenever the Rust compiler team decides to a new enough version of LLVM that supports it. There's not much users can do with it until then.

From what I reed, BOLT already exists in the GitHub repository I link above and it can at this moment be used with a LLVM and GCC binary. I think that the merge of the code tree will give a tighter integration with LLVM, but it can already be used.

But because it’s a profiler guided optimization it has many steps like PGO and requires installation of extra software, so a nice tutorial or article focused on Rust, would allow a greater numbers of the members of the Rust community to use the process more.

Best regards,
João

Adding to existing doc would be wise when it eventually comes.
https://doc.rust-lang.org/rustc/profile-guided-optimization.html