WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: LTO benchmark  (Read 3732 times)

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
LTO benchmark
« on: December 07, 2013, 02:15:13 PM »
LTO (Link Time Optimization) is a GCC feature to provide additional optimization on the traditional ones. I made an ad-hoc benchmarking of the new Linaro 4.8 2013.11 (GCC 4.8.3 pre) and binutils 2.4 building common archivers, measuring performance of LTO and compared to BusyBox equivalent too.

Size gain of executable files resulted by LTO is between 0 and 8% depending on application. Compilation time is increasing significantly, by 60-100% or even more. What is about performance? There are no significant change except mainstream tar when LTO optimized version is 100% faster creating tar file.

The most interesting is the BusyBox comparision. In most cases it has the same or better performance than the mainstream equivalent except gzip. I was supprized, expected much worst result for BusyBox.

Second table shows runtime in mm:ss



It is a quick ad-hoc test, but a good indication what you can expect from LTO. If you are compiling a program, it is worth to try LTO if you have GCC 4.7.x or 4.8.x (expecting toolchain supports LTO). Just add -flto to compiler flags. Result must be similar on x86

« Last Edit: December 07, 2013, 02:22:52 PM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14794
Re: LTO benchmark
« Reply #1 on: December 07, 2013, 10:42:15 PM »
Is there a difference in size if you use lto like this:
Code: [Select]
CC="gcc -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe" CXX="g++ -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr/loca
Note that you usually need something like this before running "make":
Code: [Select]
find . -name Makefile -type f -exec sed -i 's/-O2/ /g' {} \;

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: LTO benchmark
« Reply #2 on: December 08, 2013, 06:27:41 AM »
In general I'm using this:
Code: [Select]
export CFLAGS="-Os -pipe -flto"
export CXXFLAGS="-Os -pipe -fno-exceptions -fno-rtti -flto"
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig

./configure --prefix=/usr/local

make

-fuse-linker-plugin is not necessary as toolchain is using it automatically. Also toolchain is using proper CPU settings by default for the RPi, no need for -march and so on.
« Last Edit: December 08, 2013, 06:29:33 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."