Hi, I’m looking into whether or not we should be using LTCG and/or ThinLTO for our shipping builds, but documentation on these features is hard to come by. Specific details I’m interested in understanding:
What benefits should we expect to see from bAllowLTCG (and under what scenarios/platforms)?
When should bPreferThinLTO be enabled (and on what platforms)?
What are the downsides/gotchas to be aware of, if any?
Is there anything required to take advantage of link time code generation other than setting bAllowLTCG/bPreferThinLTO?
Does Epic have any general “best practice” recommendations for using these features? I assume bPGOProfile would be good to use as well, if possible.
This is in the context of a multiplatform title targeting console and PCs. Info regarding mobile support is interesting, but not relevant for our project.
ThinLTO is a new approach to whole program optimization that was introduced in Clang. It is faster and uses less RAM than the classic approach while providing similar improvements. You can get more details on this blog post: https://blog.llvm.org/2016/06/thinlto\-scalable\-and\-incremental\-lto.html
UBT is using ThinLTO by default since version 5.7 (bPreferThinLTO = true). You should definitely try it with prior releases as it is a feature from the compiler and not the engine. I’m aware there has been some bugs with some consoles SDKs but they have been resolved in the most recent versions.
Last I heard, we were seeing up to 10% improvement in runtime performance.
Thanks, that is good information. I was able to compile successfully with bAllowLTCG and bPreferThinLTO in 5.6.1. Based purely on vibes, it feels like it may be a tangible performance improvement, but I’m not sure by how much since it’s hard to find a consistent scenario to A/B compare.
From that article, it sounds like the only downside is slightly longer link times when building, is that correct? If the behavior should otherwise be “the same but occasionally faster” then I think we’ll try keeping it enabled.