Ubuntu 21.04 To Turn On LTO Optimizations For Its Packages
Joining the likes of Fedora and openSUSE who have been enabling LTO optimizations by default for their package builds, Ubuntu developers are working to flip on link-time optimizations by default with their package builds. The plan is to have LTO enabled for all 64-bit package builds, namely for x86_64 and AArch64 as most notable, but the RISC-V 64-bit support won't see LTO at this point. POWER PPC64LE and s390x will also see LTO in addition to AArch64 and x86_64.
Link-time optimizations is about allowing for compiler optimizations at link-time on generally the entire program rather than just on a per-file/per-object basis. Link-time optimizations with this greater scope can pay off big time especially for larger code-bases. The optimizations at link-time tend to be beneficial for the resulting binary's program and in some case smaller file size, etc.
The downside to link-time optimizations are in some cases significantly longer compile times and can have an impact on memory use, but in this case it's just impacting the Ubuntu package build farm. Seeing Ubuntu 21.04 planning to LTO packages is terrific and great seeing more Linux distributions applying these compiler optimizations to all packages (granted, some exceptions like the GCC LTO support for the Linux kernel not being mainlined).
Matthias Klose sent out word that they are planning to enable link-time optimizations with Ubuntu 21.04 by default once the Glibc 2.33 C library is added to the release pocket. Upstream Debian meanwhile isn't planning on LTO-by-default for its packages until Debian 12 "Bookworm" and not the upcoming Debian 11.
The plans around Ubuntu flipping on LTO for package builds can be found via the Ubuntu Wiki. Great seeing this happening and will make Ubuntu 21.04 benchmarking even more fun coming up.