Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-performance
Navigation:
Lists: gentoo-performance: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-performance@g.o
From: Bart Alewijnse <scarfboy@...>
Subject: Re: inline considered harmful
Date: Thu, 22 Jul 2004 16:35:11 +0200
I'm curious as to how many of you have considered and tried using -Os
for your programs, and it might even apply to parts of the kernel.

I'm not kidding. On half of my C++ programs, usually those that deal
with mostly hard processing, there is no discernable difference
between -O2 or -O3 and -Os, except that -Os executables are smaller,
and every now and then a benchmark (though that tends to be 'do
something a lot of times in a row', which of course is mostly a
nonsense benchmark) will turn out faster - I have yet to see a case in
which -Os performs noticeablyworse - and most of the time it's about
the same, although that might just be the sort of things I use C for.

That code size in itself seems to almost completely balance the
optimisations gcc can do (...not that -Os has no optimisations at
all), especially for what in practice are my small, central object
files gave me a whole new perspective on how much more central the
cache is to speed these days. I think many more programs could
benefit, actually.

For the heck of it, I just compiled md5 with it standard O3 and with
Os. It made a tiny yet
of 150 to 200 ms in favour of Os. (on a a scale of 26 seconds; I used
kcore, so caching should have had no effect [actually, on a 100MB file
in shm, well within cacheability, O3 was faster, by abotu the same
amont, on a 3 second scale (I did this on a slower processor,
'course)]) But md5 isn't the best example, as it's data crunching, and
not very complex code. I'ld be amazed if it weren't completely cached
either way - the seven hundred bytes or so in executable size
difference (scale of 13K) saved there aren't the most important ever -
except that can be taken to be purely in code, which is partly the
point.

So I'm even more interested now. It would amuse me if you would humour
me for a few minutes and compile and run a few of your own C programs
(that don't bottleneck on syscalls or io) with Os, see whether it
makes a difference, and in what direction and magnitude.

Just for kicks, I just compiled my kernel (2.6.7 ck) with Os. It's a
shame it'd hard to measure the speed difference, but it does knock
300K (~12%) off its size. I think I'll run it for a while, see what
happens.

--Bart Alewijnse

--
gentoo-performance@g.o mailing list

Replies:
Re: inline considered harmful
-- Jerry McBride
References:
inline considered harmful
-- Mario Domenech Goulart
Re: inline considered harmful
-- Ervin NĂ©meth
Navigation:
Lists: gentoo-performance: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: inline considered harmful
Next by thread:
Re: inline considered harmful
Previous by date:
Re: inline considered harmful
Next by date:
Re: inline considered harmful


Updated Jun 17, 2009

Summary: Archive of the gentoo-performance mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.