Experiment: using -O3 in the toolchain

Ken Moffat <[email protected]>
Newsgroups gmane.linux.lfs.general
Message-ID <20120524023421.GA10366@milliways>
 Last month, I was querying the use of -O3 in glibc with x86_64 on
lfs-dev : turned out my problems on that one machine are down to
buying cheap consumer-grade hardware (it works, mostly) :)  But I
then got to thinking about using -O3 for the rest of the toolchain.
I've now completed test builds (CFLAGS and CXXFLAGS = -O2 everywhere,
and with -O3 in chapter 5 pass 2 and chapter 6 binutils, gmp, mpc,
mpfr,gcc).  Note that some packages, particularly in BLFS, ignore
CFLAGS.  The toolchain testsuite results are no different (same
failures in gcc, and with static libs which I do not install).

 This is x86_64 on an i3 (hyperthreaded dual processor, the kernel
thinks it is 4 processors) with 4GB of RAM.  I built these in
directories because they aren't intended to be used, and I didn't
build the kernel (that would be another 4 or 5 minutes!).

 Apart from that, I built everything that is currently part of my
normal desktop, and using -j3 for builds (but not installs!) except
where that gives problems.  I try to reserve some cpu so that cron
jobs, particularly backups, can run, or  so that I can browse or
listen to music if I wish to, in both cases without impacting the
build time or my listening/browsing experience.

 It's nice to now have hardware that is capable of building with -O3
on current gcc (my previous single processor machines were too slow
and too lacking in RAM), but I don't think I'll bother again.

 I used my standard scripts, so timing for each package is from
configure to the end of the install, to the nearest second.  The
times for the total build were 6 hours and 6 hours 3 minutes with
the -O3 toolchain.  The -O3 build used slightly more disk space in
/usr/bin and /usr/lib, but the difference was minimal.

 Obviously, building the toolchain with -O3 took a bit longer (20
seconds in LFS chapter 5, a bit over 3 minutes 12 sec in chapter
6), but then I saw *minor* gains in many BLFS packages, at least
until I got to QT (1294 seconds in my configuration, instead of 1256
using -O2).  I also lost half a minute in building the gnome packages
I use, but the gnome script takes about 90 minutes, mostly in webkit
with -j1, so the differences are immaterial and lost in the noise.

 If I was to do it again, I wouldn't be suprised to see a bigger
variation from doing identical builds - this isn't a hard realtime
OS.

 So, I wondered how using -O3 in the toolchain would affect the
build, and now I know.  Back when I first arrived here,
optimisations were in vogue among some people to speed up our
compiles.  I think I can happily avoid investigating optimisations
again. :)

ĸen
-- 
das eine Mal als Tragödie, das andere Mal als Farce
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.