Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
debian faster than gentoo
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
kraylus
l33t
l33t


Joined: 07 Jun 2002
Posts: 648
Location: ft.worth.tx

PostPosted: Wed Nov 05, 2003 1:20 am    Post subject: debian faster than gentoo Reply with quote

got this on my local lug mailing list. what's your take on it, guys?

Quote:
Here's an interesting snip from today's Debian Weekly News...

A while ago I ran into a similiar situation. I found that my custom
compile of Apache/mod_perll/etc was quite a bit SLOWER then Debian's (on
an AMD K6-2/500). This surprised me, because I always thought that
Debian compiled with conservative/slow settings that work on a greater
variety of machines.

Wim

>Debian faster than Gentoo? Matt Garman [2]wondered why his C++
>program ran dramatically slower when compiled on a Gentoo machine than
>when compiled with Debian Sid. He later [3]reported that recompiling
>the Gentoo C++ libraries with less aggressive optimization flags (-O2
>instead of -O3) eliminated the speed difference. Matt also [4]added
>that Debian and other distributions are conservative, but set up by
>very experienced people.
>
> 2. http://article.gmane.org/gmane.linux.gentoo.user/50924
> 3. http://article.gmane.org/gmane.linux.gentoo.user/50973
> 4. http://article.gmane.org/gmane.linux.gentoo.user/50953
>
>

_________________
I used gentoo BEFORE it was cool.
Back to top
View user's profile Send private message
TPC
Tux's lil' helper
Tux's lil' helper


Joined: 16 Sep 2003
Posts: 135
Location: Sweden

PostPosted: Wed Nov 05, 2003 1:26 am    Post subject: Reply with quote

Debian is faster for some uses. On my fast laptop Gentoo is faster than Debian, but on my old P133 Gentoo runs so slow that I can't stand it, while it runs Debian without any problems.
Back to top
View user's profile Send private message
chrispy
Apprentice
Apprentice


Joined: 10 Nov 2002
Posts: 228
Location: Tokyo

PostPosted: Wed Nov 05, 2003 1:34 am    Post subject: Reply with quote

Well, it just proves that :
1-gcc still has room for improvements
2-CFLAGS over-optimization is not the key to faster programs
3-"random" CFLAGS set because "they sound cool" usually make the binaries bigger, and if the code is badly written, can make the binaries a lot slower.

Yes, I believe the debian guys chose the compilation options very carefully because they have a lot of experience. But we do not know what cflags the guy used, which version of GCC. etc, etc...
A badly setup gentoo system, even on a fast cpu, will noticeably be slower than a carefully cooked binary distro.
Back to top
View user's profile Send private message
avenj
Retired Dev
Retired Dev


Joined: 11 Oct 2002
Posts: 495
Location: New Hampshire

PostPosted: Wed Nov 05, 2003 1:41 am    Post subject: Reply with quote

-O3 can cause significant decreases in speed. This is especially true on older systems.

On my i686 systems, I use:
-O2 -pipe -march=i686 -finline-functions -finline-limit=800
Back to top
View user's profile Send private message
RedBeard0531
Guru
Guru


Joined: 21 Sep 2002
Posts: 415
Location: maryland

PostPosted: Wed Nov 05, 2003 2:56 am    Post subject: Reply with quote

I find -Os to work quite well. It is much faster than -O3 and save lots of space over -O2. Several people have had similar experiances.
_________________
OH MY GOD! Kenny just killed Kenny!
That Basterd!
Back to top
View user's profile Send private message
MatzeOne
Guru
Guru


Joined: 07 Sep 2003
Posts: 579
Location: Hamburg, Germany

PostPosted: Wed Nov 05, 2003 4:39 am    Post subject: Reply with quote

RedBeard0531 wrote:
I find -Os to work quite well. It is much faster than -O3 and save lots of space over -O2. Several people have had similar experiances.


yes.. people like me ;)
_________________
Mit null lässt sich eine ganze Menge machen.
Sportschule Hamburg
Back to top
View user's profile Send private message
nbensa
l33t
l33t


Joined: 10 Jul 2002
Posts: 799
Location: Buenos Aires, Argentina

PostPosted: Wed Nov 05, 2003 4:57 am    Post subject: Reply with quote

MatzeOne wrote:
yes.. people like me ;)


And me... :-)
Back to top
View user's profile Send private message
Lovechild
Advocate
Advocate


Joined: 17 May 2002
Posts: 2858
Location: Århus, Denmark

PostPosted: Wed Nov 05, 2003 7:50 am    Post subject: Reply with quote

I have my system on -march=athlon-xp -O -pipe and it's no slower than my uber optimized Gentoo system was - of course it's freebsd so it's kinda hard to compare the two.
Back to top
View user's profile Send private message
avenj
Retired Dev
Retired Dev


Joined: 11 Oct 2002
Posts: 495
Location: New Hampshire

PostPosted: Wed Nov 05, 2003 8:15 am    Post subject: Reply with quote

"Optimize smarter, not harder"
Back to top
View user's profile Send private message
beejay
Retired Dev
Retired Dev


Joined: 03 Oct 2002
Posts: 924
Location: Flensungen (das liegt neben Merlau)

PostPosted: Wed Nov 05, 2003 8:56 am    Post subject: Reply with quote

Before I say anything else : I am a persuaded user of Gentoo...

...but on my Notebook Gentoo really is quite slow. I have a FreeBSD on a 2nd partition and it really runs faster. The Notebook is not throttled, and my CFLAGS still are the original CFLAGS from the P4-LiveCD. However the reason could also be that I chose XFS as I did on my Desktop - but I had really bad experiences with Reiser and I still do not have enough trust in ext3.

A lot of (new) Gentooists are too fascinated by the ability to set up Compiler-Options and I'm sure that a lot of them exaggerate optimization.
What about example-lines in make.conf, say two for every CPU (one for konservative optimization and one for harder [but not exaggerate] optimization) ?
_________________
Dort wo schwarzer Rauch aufsteigt, sich alsbald ein Fehler zeigt.
www.paludis-sucks.org | www.gentoo.de | www.gentoo-ev.org | www.gentoo.org
Back to top
View user's profile Send private message
Mystilleef
Guru
Guru


Joined: 27 Apr 2003
Posts: 561
Location: Earth

PostPosted: Wed Nov 05, 2003 12:18 pm    Post subject: Reply with quote

I've noticed a lot of gentoo users choose optimization flags without researching them thoroughly. On several occassions I've seen people post flags on this forums that could essentially ruin their system all in the name of speed. With a little bit of reading (man/info gcc) and a little bit of common sense you could get an extremely optimized system. I see people thinking the more flags they have in make.conf the more l33t their system will be. Well, that's false.

Code:

-w -march=athlon -pipe -fforce-addr -fomit-frame-pointer -Os -s

_________________
simple, sleek and sexy text editor for gnome

"My logic is undeniable."
Back to top
View user's profile Send private message
avenj
Retired Dev
Retired Dev


Joined: 11 Oct 2002
Posts: 495
Location: New Hampshire

PostPosted: Wed Nov 05, 2003 4:39 pm    Post subject: Reply with quote

Mystilleef wrote:
I've noticed a lot of gentoo users choose optimization flags without researching them thoroughly. On several occassions I've seen people post flags on this forums that could essentially ruin their system all in the name of speed. With a little bit of reading (man/info gcc) and a little bit of common sense you could get an extremely optimized system. I see people thinking the more flags they have in make.conf the more l33t their system will be. Well, that's false.

Code:

-w -march=athlon -pipe -fforce-addr -fomit-frame-pointer -Os -s


Yeah, it's the enough rope to hang self issue.
Back to top
View user's profile Send private message
Azaghal
Tux's lil' helper
Tux's lil' helper


Joined: 02 May 2003
Posts: 103

PostPosted: Wed Nov 05, 2003 5:57 pm    Post subject: Reply with quote

-Os seems to be 'hot' now.

Everyone seems to have a different view on cflags, even while I get the impression that some ppl think it will make huge differences. Gentoo-ers seem to be very eager at falling back to excuses like "he had his cflags wrong" when someone dares to suggest that Gentoo maybe isn't that 'super fast' at all.

Did anyone ever really bother researching this topic, like comparing different flags for different applications, and having hard numbers in stuff like launch times, etc.

I'm not trying to troll here, but I've yet to see the first proof for claims like "-Os is so much faster than -O3, I can really feel the 10 ms difference it makes when starting the application!" or "my system is 100% optimized, it's so much faster than distro X, I have -fblablabla -omit balblalba -somel33tflag -somedebuggingflagthatsoundscool -O3 -pipe -s -l33t"........
_________________
generatesig
Back to top
View user's profile Send private message
Mystilleef
Guru
Guru


Joined: 27 Apr 2003
Posts: 561
Location: Earth

PostPosted: Wed Nov 05, 2003 6:05 pm    Post subject: Reply with quote

Azaghal wrote:
-Os seems to be 'hot' now.

Everyone seems to have a different view on cflags, even while I get the impression that some ppl think it will make huge differences. Gentoo-ers seem to be very eager at falling back to excuses like "he had his cflags wrong" when someone dares to suggest that Gentoo maybe isn't that 'super fast' at all.

Did anyone ever really bother researching this topic, like comparing different flags for different applications, and having hard numbers in stuff like launch times, etc.

I'm not trying to troll here, but I've yet to see the first proof for claims like "-Os is so much faster than -O3, I can really feel the 10 ms difference it makes when starting the application!" or "my system is 100% optimized, it's so much faster than distro X, I have -fblablabla -omit balblalba -somel33tflag -somedebuggingflagthatsoundscool -O3 -pipe -s -l33t"........


Search the forums. It's been discussed to death. And benchmarks are useless. Why don't you do the comparison or experiment yourself. Compile Xchat with -Os and then with -O3 and then you be the judge. Why are you waiting for someone else to do what you can do yourself?
_________________
simple, sleek and sexy text editor for gnome

"My logic is undeniable."
Back to top
View user's profile Send private message
Azaghal
Tux's lil' helper
Tux's lil' helper


Joined: 02 May 2003
Posts: 103

PostPosted: Wed Nov 05, 2003 6:31 pm    Post subject: Reply with quote

Mystilleef wrote:

Search the forums. It's been discussed to death. And benchmarks are useless. Why don't you do the comparison or experiment yourself. Compile Xchat with -Os and then with -O3 and then you be the judge. Why are you waiting for someone else to do what you can do yourself?


Because I wouldn't be able to tell the difference? Perhaps the random 1% bump CPU X caused was the difference between the 100 ms later launch time.

The benchmarks I've seen aren't that great. Some benchmarks even contradict each other...

So there's still no clear answer. -Os -O3 -O2 or nothing at all? There should be a clear answer from the gcc team (or someone else with authority on the subject) to end the story...
_________________
generatesig
Back to top
View user's profile Send private message
professorn
Apprentice
Apprentice


Joined: 18 Sep 2003
Posts: 235
Location: Stockholm, Sweden

PostPosted: Wed Nov 05, 2003 8:10 pm    Post subject: Reply with quote

Probably depends on code too =/
Back to top
View user's profile Send private message
slarti`
Retired Dev
Retired Dev


Joined: 20 Sep 2003
Posts: 376
Location: UK

PostPosted: Wed Nov 05, 2003 8:31 pm    Post subject: Reply with quote

Yes, I agree with Azaghal. I doubt very much that most CFLAGS make a huge difference. Obviously some do, but many long and aggressive flags are just over-optimizing and making things slower.

It makes me laugh a bit when people still using 2.4 kernels come up with some huge list of their CFLAGS.. I tell them to upgrade to 2.6 and then notice the difference ;)

BTW, I read an article on linmag.au put forward to me by some Debian users on an IRC channel a while ago. It gave benchmarks for starting OOWriter, performing an operation in GIMP, and one or two other things which I can't remember (long time ago). Gentoo came up often 10x worse than Debian, and Mandrake of all things.. I still deeply question what CFLAGS they were using however... so yes, a knowledge of CFLAGS (something I'm sadly missing :P) is important for getting the most out of Gentoo, until you have some really decent CFLAGS you can't claim to have any real speed boost over xyz distro.
_________________
Gentoo/AMD64, shell-tools, net-mail, vim, recruiters
IRC: slarti @ irc.freenode.net
Devspace
Back to top
View user's profile Send private message
Mystilleef
Guru
Guru


Joined: 27 Apr 2003
Posts: 561
Location: Earth

PostPosted: Thu Nov 06, 2003 1:03 am    Post subject: Reply with quote

Azaghal wrote:
Mystilleef wrote:

Search the forums. It's been discussed to death. And benchmarks are useless. Why don't you do the comparison or experiment yourself. Compile Xchat with -Os and then with -O3 and then you be the judge. Why are you waiting for someone else to do what you can do yourself?


Because I wouldn't be able to tell the difference? Perhaps the random 1% bump CPU X caused was the difference between the 100 ms later launch time.

The benchmarks I've seen aren't that great. Some benchmarks even contradict each other...

So there's still no clear answer. -Os -O3 -O2 or nothing at all? There should be a clear answer from the gcc team (or someone else with authority on the subject) to end the story...


Once again, there are clear answers, you are just adamant on others doing what you could do yourself. What's so hard in compiling a small programs using different flags and measuring their startup time, their size and their runtime speed. That in addition to man gcc will give you all the answers in the world you need.

Again, it all boils down to what I said, people use flags without doing enough research or tests on them and then come to the boards with misconceptions that flags don't provide any optimizations or speed improvements or they are slow, when infact they are wrong. Or just add a bunch of flags that someone else has recommended for them, thinking the more flags they use, the optimized their system will be.

If in your experience or experiments the flags don't provide any improvement and you think the intelligent folks at gcc are talking a lot of crap in the man pages, then by all means, don't use any optimization flags.
_________________
simple, sleek and sexy text editor for gnome

"My logic is undeniable."
Back to top
View user's profile Send private message
Evangelion
Veteran
Veteran


Joined: 31 May 2002
Posts: 1087
Location: Helsinki, Finland

PostPosted: Thu Nov 06, 2003 7:44 am    Post subject: Reply with quote

Azaghal wrote:
Did anyone ever really bother researching this topic, like comparing different flags for different applications, and having hard numbers in stuff like launch times, etc.


Yes

Quote:
To give a rough break-down of their effectiveness would be difficult, but their aggregate effect is to reduce my initial run time from 347 to 241 seconds, which amounts to roughly a 47% increase in speed (the former was the runtime for the flag set I was using routinely before this investigation). Not too shabby.


Those benchmarks were done with -O3 however.
_________________
My tech-blog | My other blog
Back to top
View user's profile Send private message
ed0n
l33t
l33t


Joined: 23 Apr 2003
Posts: 638
Location: Prishtine/Kosove

PostPosted: Thu Nov 06, 2003 12:57 pm    Post subject: Reply with quote

avenj wrote:
"Optimize smarter, not harder"


said good.
Back to top
View user's profile Send private message
shm
Advocate
Advocate


Joined: 09 Dec 2002
Posts: 2380
Location: Atlanta, Universe

PostPosted: Fri Nov 07, 2003 9:21 pm    Post subject: Reply with quote

Very few people using gentoo optimize with -O3 anymore.. this guy is just a dumbass.
_________________
what up
Back to top
View user's profile Send private message
hensan
l33t
l33t


Joined: 26 Jun 2003
Posts: 868
Location: Sweden

PostPosted: Fri Nov 07, 2003 9:38 pm    Post subject: Reply with quote

shm wrote:
Very few people using gentoo optimize with -O3 anymore


Anywhere from 51% to 70% of gentoo users use -O3, that's hardly "very few".

I'm running O3 and it's working great. I think avenj is right though, on older systems O2 or Os might create more responsive apps.
Back to top
View user's profile Send private message
ozonator
Guru
Guru


Joined: 11 Jun 2003
Posts: 591
Location: Ontario, Canada

PostPosted: Sat Nov 08, 2003 5:48 am    Post subject: Reply with quote

Okay, I know this is highly unscientific, and based mostly on my perception of how fast things are (haven't got enough time to do thorough benchmarking), but this thread and the original story from DWN inspired me to do a little experimenting. On my Duron 1200 machine (a little over a year old, Asus A7V266-C, 256 MB DDR266 RAM, 7200 RPM disk), my glibc had been installed with gcc 3.2.3, with these CFLAGS, which I'd happily been using for a while: "-O3 -pipe -march=athlon-xp -mmmx -msse -m3dnow -mfpmath=sse -fforce-addr -fomit-frame-pointer -funroll-loops -foptimize-sibling-calls -fstack-protector" After reading a bit more about optimization in these forums and elsewhere on the web, the message of "smarter, not harder" optimization sunk in. I decided to try these CFLAGS: "-O2 -s -pipe -march=athlon-xp -mmmx -msse -m3dnow -mfpmath=sse -fforce-addr -fomit-frame-pointer -foptimize-sibling-calls -fstack-protector" -- in other words, switch -O3 to -O2, drop -funroll-loops, and add -s.

Then, some recompiling: first, glibc (2.3.2-r1, latest unmasked for x86). After that, I opened a few apps that I was sure I hadn't opened since my last reboot -- dillo, jpilot, rox, among others -- and was pleasantly surprised: it did seem snappier than I remembered it being before, at least in opening. Remember, I said this wouldn't be a scientific test, just a perceptual one, but still -- these apps opened almost instantly, and I remembered them taking at least a little bit of time before.

So, I decided to recompile gcc, binutils, and some of my frequently used apps. With only a few exceptions, I noticed that each binary size is notably smaller. Some examples, in bytes: aterm, 164820 -> 125492; dillo, 407940 -> 340808; gpg, 820940 -> 698864. Some bigger ones: gvim, 2497236 -> 2121300; gs, 3970960 -> 3363988; abiword, 4423616 -> 4106464; and the biggest change, gnumeric, 8799965 -> 3552960. :!: All seemed snappier starting up, particularly those with large binary sizes, as -Os advocates already know. Once loaded, they're just as fast as I remember them. Again, this is not scientific, but I notice a significant enough change for me to think there's a difference, and to be pleased. And, -O2 certainly does quite a bit to reduce binary size, along with dropping -funroll-loops and adding -s.

This got me thinking some more, so I decided to do another test, still unscientific, but one less reliant on my perception alone: convert a PDF version of my doctoral dissertation to postscript (mostly text in a PDF created by pdflatex; the file is 785752 bytes long, a size that shouldn't tax my disk or RAM much), and see how long it takes with each optimization: "time pdf2ps test.pdf O<level>.ps", where <level> is the optimization level used to compile ghostscript (pdf2ps is a script that calls gs). The ebuild involved is ghostscript-7.05.6-r3, which provides gs and pdf2ps. Conditions: each test was run with the glibc that I had re-compiled with -O2; the -O3 test was run with my original CFLAGS quoted above, since they represented my initial (untest, perhaps more naive) thoughts about optimization. Each run was done with lots of free RAM (no swapping needed), and no other CPU load. Also, I timed the results of the first run of each freshly-compiled binary (i.e., to reduce the effects of cacheing, and thus maybe give a better sense of load + execution time).

Results:

Code:
$ time pdf2ps test.pdf Os.ps

real    0m23.668s
user    0m21.850s
sys     0m0.695s

$ time pdf2ps test.pdf O2.ps

real    0m23.838s
user    0m22.345s
sys     0m0.670s

$ time pdf2ps test.pdf O3.ps

real    0m25.230s
user    0m23.075s
sys     0m0.710s


I can already hear the chorus of -Os advocates chanting "I told you so"... yes, you did. In this test, -Os wins by a small margin over -O2; -O3 trails both. I repeated the test once more, and got similar results. (An aside: fortunately, gs produced exactly the same postscript code each time. :) )

Addendum re. binary size: I re-emerged ghostscript (7.05.6-r3), subtituting -Os for -O2 in my CFLAGS. The resulting gs binary is 2921652 bytes (vs. 3363988 with -O2, and 3970960 with -O3 and -funroll-loops added but -s removed). Again, the move to -Os from -O2 led to a non-trivial drop in binary size.

Of course, this test involved a single program doing a single task on a single machine, so it's nowhere near enough data to generalize over all situations; I'm sure -O3 with more aggressive optimization can indeed make a difference for some things, especially some CPU-intensive things. Unfortunately, I don't have time to test every program like this, and surely there are other optimizations that might make a difference, too. But at least for my case, I can draw some conclusions -- wildly extrapolate, rely on unjustifiable induction, whatever -- that can make me feel more confident that I'm using CFLAGS that are approaching the best for me and this machine. For programs that I start/stop frequently, the new CFLAGS (the new ones quoted above, with -Os in place of -O2) are definitely better -- the smaller binary size should help programs load more quickly, which will increased their perceived speed, and maybe reduce RAM usage a bit. I haven't yet decided for sure what I'm going to do for programs that I load infrequently, but that stay loaded for a long time -- X, window manager, Mozilla, and, to a lesser extent, things like mutt or xmms -- any of which might benefit less from smaller binary size and more from more aggressive optimization. The biggest quandary might be with things like mplayer or xine, which aren't always running, but with which I want the best performance. I may try comparing different optimization settings for a couple of them someday -- but not today!

A pleasant side-effect of all this is a reduction in disk usage; I'm not short of disk space, but efficiency is efficiency, whether applied to CPU or disk space; I'm thus happy to have smaller binary sizes.

Some of you may be wondering why I'm not using -ffast-math or -mfpmath=sse,387. The settings I've chosen are the ones I'm most comfortable with. For me, stability is more important than that extra few percent of efficiency, so any hint in the gcc man page of something that might affect stability when a particular option is used means I'd prefer to avoid that option, even if it's probably safe in most cases.

A final note: I wasn't dissatisfied with performance before, so I'm not really worried that much about this whole issue, though I am curious, and pleased with the results here. Should you draw your own conclusions from this, and switch to -Os? That's up to you; YMMV, of course, and if you have the time and interest, I'd encourage you to do some testing of your own, appropriate for your machine, architecture, most-used programs, etc. As for me, I'm glad to have done this mini-experiment, and I hope to continue enjoying Gentoo here. :)
Back to top
View user's profile Send private message
siti
Tux's lil' helper
Tux's lil' helper


Joined: 05 May 2003
Posts: 118
Location: Canterbury, New Zealand

PostPosted: Sat Nov 08, 2003 7:28 am    Post subject: Reply with quote

ozonator: On a side note I have read that you make Propolice ineffective when enabling -O3 :)
Back to top
View user's profile Send private message
sindre
Guru
Guru


Joined: 01 Nov 2002
Posts: 315
Location: Norway

PostPosted: Sat Nov 08, 2003 9:47 am    Post subject: Reply with quote

Just wondering, will you get a performance hit if you use propolice?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum