[systemd-devel] Is LTO worth it?
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Wed Jan 13 12:51:25 UTC 2021
On Mon, Jan 11, 2021 at 06:05:26PM +0100, Michael Biebl wrote:
> Am Mo., 11. Jan. 2021 um 16:39 Uhr schrieb Lennart Poettering
> <lennart at poettering.net>:
> > https://fedoraproject.org/wiki/LTOByDefault
>
> Interestingly, that wiki page says, that LTO should produce smaller
> binaries, which clearly isn't the case here.
I think LTO should be understood as "work in progress".
Making it the default in Fedora surfaced a few different issues in the
compiler, and some packages needed to temporarily opt out. Compiler
maintainers worked on those, and I think they have been all or almost
all resolved. But since they were working on just making the thing work,
they most likely didn't have too much time to work on improvements.
The initial reports spoke about a few percent savings on average,
with significantly larger savings for some packages, esp. C++ programs.
Hopefully, we will see bigger savings in the future.
> I wonder whether the wiki is incorrect or whether this is a toolchain
> issue or if this is specific to systemd
> Or maybe this is Debian specific. Would be interested to see numbers
> from other distros.
This is a rebuild of systemd package with standard settings (lto, -O2) and without lto (-O2):
$ ls -l *rpm no-lto/*rpm
9932144 Jan 13 13:03 systemd-247.2-2.fc34.src.rpm (with lto)
9932165 Jan 13 13:28 systemd-247.2-2.fc34.src.rpm (the second number is always without lto)
4411100 Jan 13 13:07 systemd-247.2-2.fc34.x86_64.rpm
4412181 Jan 13 13:31 systemd-247.2-2.fc34.x86_64.rpm
512945 Jan 13 13:07 systemd-container-247.2-2.fc34.x86_64.rpm <--
548286 Jan 13 13:31 systemd-container-247.2-2.fc34.x86_64.rpm <--
1105667 Jan 13 13:07 systemd-container-debuginfo-247.2-2.fc34.x86_64.rpm
1584398 Jan 13 13:31 systemd-container-debuginfo-247.2-2.fc34.x86_64.rpm
9608297 Jan 13 13:08 systemd-debuginfo-247.2-2.fc34.x86_64.rpm
9779602 Jan 13 13:31 systemd-debuginfo-247.2-2.fc34.x86_64.rpm
3012544 Jan 13 13:08 systemd-debugsource-247.2-2.fc34.x86_64.rpm
3010956 Jan 13 13:31 systemd-debugsource-247.2-2.fc34.x86_64.rpm
441654 Jan 13 13:07 systemd-devel-247.2-2.fc34.x86_64.rpm
441622 Jan 13 13:31 systemd-devel-247.2-2.fc34.x86_64.rpm
104294 Jan 13 13:07 systemd-journal-remote-247.2-2.fc34.x86_64.rpm
105182 Jan 13 13:31 systemd-journal-remote-247.2-2.fc34.x86_64.rpm
157884 Jan 13 13:07 systemd-journal-remote-debuginfo-247.2-2.fc34.x86_64.rpm
157852 Jan 13 13:31 systemd-journal-remote-debuginfo-247.2-2.fc34.x86_64.rpm
558758 Jan 13 13:07 systemd-libs-247.2-2.fc34.x86_64.rpm <--
610528 Jan 13 13:31 systemd-libs-247.2-2.fc34.x86_64.rpm <--
1572056 Jan 13 13:07 systemd-libs-debuginfo-247.2-2.fc34.x86_64.rpm <--
2939352 Jan 13 13:31 systemd-libs-debuginfo-247.2-2.fc34.x86_64.rpm <--
486239 Jan 13 13:07 systemd-networkd-247.2-2.fc34.x86_64.rpm
501935 Jan 13 13:31 systemd-networkd-247.2-2.fc34.x86_64.rpm
1144027 Jan 13 13:07 systemd-networkd-debuginfo-247.2-2.fc34.x86_64.rpm
1263367 Jan 13 13:31 systemd-networkd-debuginfo-247.2-2.fc34.x86_64.rpm
319473 Jan 13 13:07 systemd-pam-247.2-2.fc34.x86_64.rpm
362518 Jan 13 13:31 systemd-pam-247.2-2.fc34.x86_64.rpm
979482 Jan 13 13:07 systemd-pam-debuginfo-247.2-2.fc34.x86_64.rpm
1726838 Jan 13 13:31 systemd-pam-debuginfo-247.2-2.fc34.x86_64.rpm
26582 Jan 13 13:07 systemd-rpm-macros-247.2-2.fc34.noarch.rpm
26553 Jan 13 13:31 systemd-rpm-macros-247.2-2.fc34.noarch.rpm
110101 Jan 13 13:07 systemd-standalone-sysusers-247.2-2.fc34.x86_64.rpm <--
139709 Jan 13 13:31 systemd-standalone-sysusers-247.2-2.fc34.x86_64.rpm <--
284825 Jan 13 13:07 systemd-standalone-sysusers-debuginfo-247.2-2.fc34.x86_64.rpm <--
759506 Jan 13 13:31 systemd-standalone-sysusers-debuginfo-247.2-2.fc34.x86_64.rpm <--
153608 Jan 13 13:07 systemd-standalone-tmpfiles-247.2-2.fc34.x86_64.rpm <--
184424 Jan 13 13:31 systemd-standalone-tmpfiles-247.2-2.fc34.x86_64.rpm <--
389470 Jan 13 13:07 systemd-standalone-tmpfiles-debuginfo-247.2-2.fc34.x86_64.rpm
727117 Jan 13 13:31 systemd-standalone-tmpfiles-debuginfo-247.2-2.fc34.x86_64.rpm
4601160 Jan 13 13:08 systemd-tests-247.2-2.fc34.x86_64.rpm
4635619 Jan 13 13:31 systemd-tests-247.2-2.fc34.x86_64.rpm
15261886 Jan 13 13:08 systemd-tests-debuginfo-247.2-2.fc34.x86_64.rpm <--
21949592 Jan 13 13:32 systemd-tests-debuginfo-247.2-2.fc34.x86_64.rpm <--
1568229 Jan 13 13:07 systemd-udev-247.2-2.fc34.x86_64.rpm
1571073 Jan 13 13:31 systemd-udev-247.2-2.fc34.x86_64.rpm
934456 Jan 13 13:07 systemd-udev-debuginfo-247.2-2.fc34.x86_64.rpm
986681 Jan 13 13:31 systemd-udev-debuginfo-247.2-2.fc34.x86_64.rpm
So we get some small savings in package size, with huge savings in
-debuginfo packages.
> Concerning the build speed: I wonder whether at least disabling LTO on
> our CI would make sense. We don't really care for fast/small
> executables there.
We could disable it on some CIs. I agree that disabling it everywhere
would be detrimental.
Zbyszek
More information about the systemd-devel
mailing list