chaotic-aur / toolbox

Unified kit with all the scripts required for maintaining the repository 🧰
https://aur.chaotic.cx
GNU Affero General Public License v3.0
81 stars 11 forks source link

Switch to thin lto for LTO builds. #31

Closed Edu4rdSHL closed 2 years ago

Edu4rdSHL commented 2 years ago

In a few cases, ThinLTO even outperforms full LTO, most likely because the higher scalability of ThinLTO allows using a more aggressive backend optimization pipeline (similar to that of a non-LTO build). - LLVM Blog

Thin LTO supports much better parallelism than fat LTO. It can achieve similar performance improvements as fat LTO (sometimes even better) while taking much less total time by taking advantage of more CPUs. - Rust Lang blog.

My understanding is that normally Full LTO disables some optimizations that don't scale with the increased size of the optimization unit, but because Thin LTO deals with smaller optimization units, it can keep these optimizations enabled, while additionally having some of the benefits of Full LTO.

So, we have only positive things here, in both compiling time and - probably - performance.

I personally have tested the builds here and they work perfectly, with no problems on -dkms drivers and general usage.

Signed-off-by: Edu4rdSHL edu4rdshl@protonmail.com

Edu4rdSHL commented 2 years ago

For me, the "thin" benchmarking better than "full" should be considered an issue on LLVM's side.

But I'm okay with this change.

Yes, that's a reasonable thought, however, there are multiple sources of that behavior where thin performs better than full LTO.

And thanks @dr460nf1r3 for merging. :tada: