godot
godot copied to clipboard
SCons: Make `lto=auto` prefer ThinLTO over full LTO for LLVM targets
Edit: Changed the scope of this PR to only impact targets for which we already used LLVM's full LTO, and change those to ThinLTO, to speed up builds significantly.
This speeds up build time considerably for these platforms compared to
using lto=full
, which is sadly single-threaded with LLVM, unlike GCC.
Changes to default behavior of lto=auto
(i.e. production=yes
):
- Linux: Prefer ThinLTO for LLVM
- Web: Prefer ThinLTO
- Windows: Prefer ThinLTO for llvm-mingw
The following LLVM targets don't use LTO by default currently, which needs to be assessed further (gains from LLVM LTO on performance need to be weighed against the potential size increase from heavy inlining):
- Android
- iOS
- macOS
- Windows clang-cl
Needs heavy testing and comparison of builds with and without LTO (thin
/full
) for the affected platforms.
We should benchmark and documents once and for all the impact of LTO on build time, build size, and performance for each platform, so we can default to the optimal configuration out of the box.