Today I've read (twice) that the overhead of frame pointers on the runtime of the compiler, GCC, is 10%. This number is nonsense. The actual overhead is 1%, and I have done the tests that show this. I want to note up front that it was also claimed that GCC slowed down by 10% between Fedora 37 & 38 (when frame pointers were introduced). However frame pointers have been disabled in our GCC build on all architectures for 9 months, since before Fedora 38 was released. So if there has been such a slowdown (which I don't know) then it cannot be anything to do with frame pointers. At the same time GCC was upgraded from 12 to 13, such a signicant new release that claims comparing versions of Fedora are not valid. - - - In my tests I recompiled GCC with frame pointers enabled (see gcc-add-fp.patch), and then built qemu with 'make clean; time make -j32'. I took the 'user' time over 3 runs. The average user time was 1135 seconds. I then recompiled binutils with frame pointers disabled (see binutils-no-fp.patch), and installed it alongside gcc-13.2.1-4.fc40.x86_64 (which as noted above has frame pointers disabled). The average user time over 3 runs was 1122 seconds. With frame pointers: 1135 seconds Without frame pointers: 1122 seconds Overhead: 1.01% Note also that the wallclock time in every case was either 41 or 42 seconds, so in practical terms for users there is no difference with or without frame pointers. You may also note that I didn't recompile any libraries (so in my tests, frame pointers are used in both cases). However using profiling we can show that this doesn't matter. The total time used during the make -j32 run by each binary and DSO was: 58.41% lto1 14.97% cc1 11.47% Linux kernel 7.68% libc.so.6 4.31% as 1.54% libbfd-2.41-7.fc40.so 0.64% libpython3.12.so.1.0 0.26% ld-linux-x86-64.so.2 0.09% ld.bfd 0.00% python3.12 (everything else under 1%) Note the only library which consumes any significant time is libc, but at under 8% it would hardly affect the test times. libbfd is actually part of binutils so it was recompiled with & without frame pointers. Full raw results are in the attached file. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Q: How much are libraries used? Children Self Shared Object + 97.79% 7.68% libc.so.6 ◆ + 65.25% 58.41% lto1 ▒ + 20.62% 14.97% cc1 ▒ + 12.33% 11.47% [kernel.kallsyms] ▒ + 8.08% 4.31% as ▒ + 6.03% 1.54% libbfd-2.41-7.fc40.so ▒ + 1.88% 0.09% ld.bfd ▒ + 0.79% 0.64% libpython3.12.so.1.0 ▒ + 0.78% 0.00% python3.12 ▒ + 0.67% 0.26% ld-linux-x86-64.so.2 ▒ build qemu 'make -j32' (2591 targets) gcc-13.2.1-4.fc40.x86_64 (FP accidentally turned off) real 0m41.297s user 18m38.587s sys 2m5.460s real 0m41.218s user 18m36.044s sys 2m3.838s real 0m41.493s user 18m42.651s sys 2m4.668s above + binutils-2.41-8.1.nofp.fc40.x86_64 (FP turned off) real 0m41.357s user 18m39.692s sys 2m4.310s real 0m41.403s user 18m43.905s sys 2m4.399s real 0m41.389s user 18m44.637s sys 2m4.407s Average user: 1122 binutils-2.41-7.fc40.x86_64 + gcc-13.2.1-4.1.fp.fc40.x86_64 (FP turned on) real 0m41.702s user 18m51.091s sys 2m3.045s real 0m42.000s user 18m56.555s sys 2m3.301s real 0m42.029s user 18m58.724s sys 2m3.922s Average user: 1135 Overhead of frame pointers: 1135/1122 = 1.01%
diff --git a/gcc.spec b/gcc.spec index 5d6c7c4..c7774fd 100644 --- a/gcc.spec +++ b/gcc.spec @@ -136,7 +136,7 @@ Summary: Various compilers (C, C++, Objective-C, ...) Name: gcc Version: %{gcc_version} -Release: %{gcc_release}%{?dist} +Release: %{gcc_release}.1.fp%{?dist} # libgcc, libgfortran, libgomp, libstdc++ and crtstuff have # GCC Runtime Exception. License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD @@ -923,7 +923,6 @@ OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-flto=auto//g;s/-flto//g;s/-ffat-lto-object OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'` OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g'` OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/ -pipe / /g'` -OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-fno-omit-frame-pointer//g;s/-mbackchain//g;s/-mno-omit-leaf-frame-pointer//g'` OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-Werror=format-security/-Wformat-security/g'` %ifarch sparc OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mcpu=ultrasparc/-mtune=ultrasparc/g;s/-mcpu=v[78]//g'`
diff --git a/binutils.spec b/binutils.spec index 472338a..d92c907 100644 --- a/binutils.spec +++ b/binutils.spec @@ -1,8 +1,9 @@ +%undefine _include_frame_pointers Summary: A GNU collection of binary utilities Name: binutils%{?_with_debug:-debug} Version: 2.41 -Release: 8%{?dist} +Release: 8.1.nofp%{?dist} License: GPL-3.0-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND BSD-3-Clause AND GFDL-1.3-or-later AND GPL-2.0-or-later LGPL-2.1-or-later AND LGPL-2.0-or-later URL: https://sourceware.org/binutils
_______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue