Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Gentoo Chat
  • Search

debian faster than gentoo

Opinions, ideas and thoughts about Gentoo. Anything and everything about Gentoo except support questions.
Post Reply
  • Print view
Advanced search
35 posts
  • Previous
  • 1
  • 2
Author
Message
ozonator
Guru
Guru
User avatar
Posts: 591
Joined: Wed Jun 11, 2003 10:48 pm
Location: Ontario, Canada

  • Quote

Post by ozonator » Sat Nov 08, 2003 2:54 pm

siti wrote:ozonator: On a side note I have read that you make Propolice ineffective when enabling -O3 :)
Hadn't heard that before, but you're right. Here's what the propolice docs say: "When you specify the option -O3, the protection instruments may be eliminated by the optimizer." So, it doesn't necessarily make propolice ineffective, but depending on the code, some optimizations might make stack protection impossible. Based on the difference between -O3 and -O2, this implies that there's something about -finline-functions and/or -frename-registers that's the source of the potential ineffectiveness. Whatever the details, no matter -- I'd rather take the chance with -fstack-protector that it can make a difference, even if only in some circumstances. Besides, now that I'll be using -Os, I can add improved propolice functionality to the list of benefits. :)

As for there being a performance hit with propolice, the propolice docs indicate that there can a performance hit of up to 8%, but in practice it should be much less than that (4% is the maximum hit they report with a 'real world' program); depending on the program, it might be nil. I didn't check for a performance hit myself, since I'd rather increase my chances of having secure code by using it. The only thing I can offer is that I also use OpenBSD, which implemented propolice system-wide a little over a year ago; I don't recall noticing any difference in speed when moving to the newly-compiled version.
Top
siti
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 118
Joined: Mon May 05, 2003 9:36 am
Location: Canterbury, New Zealand
Contact:
Contact siti
Website

  • Quote

Post by siti » Sun Nov 09, 2003 12:24 am

Some tests:
http://www.trl.ibm.com/projects/securit ... 0000000000
These tests show around 8% but these tests was done quite a while ago so it might be less than that.
Top
ozonator
Guru
Guru
User avatar
Posts: 591
Joined: Wed Jun 11, 2003 10:48 pm
Location: Ontario, Canada

  • Quote

Post by ozonator » Mon Nov 10, 2003 4:35 pm

An addendum to my initial post in this thread, reporting my experience switching to -O2/-Os from -O3.

1. Just noticed this in the ebuild for glibc-2.3.2-r1:

Code: Select all

# Lock glibc at -O2 -- linuxthreads needs it and we want to be conservative here
export CFLAGS="${CFLAGS//-O?} -O2"
export CXXFLAGS="${CFLAGS}"
If that's so, then why might re-emerging glibc with -O2 or -Os in $CFLAGS result in different performance from -O3? I thought it seemed faster when I re-emerged, but if it was compiled with -O2 in each case, the difference may have been made by the other changes to $CFLAGS I made when moving to -O2/-Os: dropping -funroll-loops and adding -s. Does that make sense?

2. In most cases, I'm finding that -Os binaries are indeed smaller than those built with -O2. While there are a few exceptions that are about the same size or a few bytes larger, there's one that seems to be much bigger with -Os: abiword -- the Abiword-2.0 binary is 4440128 bytes with -Os, 4106464 with -O2. Strange; I'll try re-emerging to make sure this isn't an anomaly. I know that -Os isn't a guarantee that the binary will be smaller, and I'm not surprised to see things coming out at approximately the same size, but I still wonder why this might be.
Top
Joe
n00b
n00b
User avatar
Posts: 70
Joined: Mon Jul 01, 2002 7:33 am
Location: Europe

There we are again...

  • Quote

Post by Joe » Tue Nov 11, 2003 1:34 am

Another point for per-package-USE-Flags...

Obviosly there isnt one compiler setting matching perfectly to all of your packages, as there isnt the one and only USE-Flags-Setting.


Regards,

Joe
Top
regeya
Apprentice
Apprentice
User avatar
Posts: 270
Joined: Sun Jul 28, 2002 6:55 pm
Location: Desoto, IL, USA

  • Quote

Post by regeya » Thu Nov 13, 2003 6:17 am

I don't know that '-Os' is 'hot' per se, but those of us with very little on-proc cache might give it a try. I've noticed a bit of a noticible difference(!)

My guess is that because the proc is doing fewer fetches from system RAM, that's giving me a bit of a boost. Again, just my guess.
Top
zhenlin
Veteran
Veteran
Posts: 1361
Joined: Sat Nov 09, 2002 4:38 pm

  • Quote

Post by zhenlin » Thu Nov 13, 2003 10:40 am

nbensa wrote:
MatzeOne wrote:yes.. people like me ;)
And me... :-)
No such luck for me - I had to file several -Os related bugs.

Back to -O2 for me.
Top
Zeitgeist
Apprentice
Apprentice
User avatar
Posts: 165
Joined: Thu Mar 13, 2003 12:06 am
Location: Ouagadougou, Burkina Faso

  • Quote

Post by Zeitgeist » Fri Nov 14, 2003 11:05 am

I've found -O2 to be faster than -O3. I see lots of people throwing out tons of cflags they don't even know what they do.

Running lots of benchmakrs and i've found -march=pentium4 -O2 -fomit-frame-pointer to be the best for m.e
Top
30726
Veteran
Veteran
Posts: 1501
Joined: Wed Sep 24, 2003 11:01 pm

  • Quote

Post by 30726 » Fri Nov 14, 2003 12:55 pm

Zeitgeist wrote:I've found -O2 to be faster than -O3. I see lots of people throwing out tons of cflags they don't even know what they do.

Running lots of benchmakrs and i've found -march=pentium4 -O2 -fomit-frame-pointer to be the best for m.e

Same here. I've had problems with both -O3 and -Os, so I'm sticking with -O2 for now on. Must be pretty stable to use since almost the entire Slackware distribution is compiled with -O2 (http://www.osnews.com/story.php?news_id=3166&page=2).
Top
Zeitgeist
Apprentice
Apprentice
User avatar
Posts: 165
Joined: Thu Mar 13, 2003 12:06 am
Location: Ouagadougou, Burkina Faso

  • Quote

Post by Zeitgeist » Fri Nov 14, 2003 2:18 pm

tln wrote:
Same here. I've had problems with both -O3 and -Os, so I'm sticking with -O2 for now on. Must be pretty stable to use since almost the entire Slackware distribution is compiled with -O2 (http://www.osnews.com/story.php?news_id=3166&page=2).
Most distributions compile with something like -O2 mpcu=i686 or something conservative. Debian only uses -O2 I believe.
Top
jcmorris
Apprentice
Apprentice
Posts: 174
Joined: Wed Jun 11, 2003 10:29 pm

  • Quote

Post by jcmorris » Sat Nov 15, 2003 3:45 am

Well guys, here is my theory. If you notice, the more flags you have, the larger the binary. However, if the optimizations produced code too large, that would increase load times, and since it just bigger code, wouldn't that translate into requiring more memory accesses to retrieve all the extra instructions and data? And, since it takes several CPU cycles per memory access, wouldn't that translate into slower overall speed an less responsiveness? Well guys, I'm in the process of installing an LFS (Linux From Scratch) system, and I'm going to use -march=athlon-xp -O2 -mfpmath=sse -fomit-frame-pointer -malign-double -ffast-math -fforce-addr -mno-push-args

My current Gentoo setup uses
-march=athlon-xp -O2 -fomit-frame-pointer -pipe -fforce-addr -maccumulate-outgoing-args -funroll-loops -mno-push-args

I think I'll compare them side-by-side. I'll let you know how it goes.

Now, the reasons why I'm going to try these particular CFLAGS:
1) I think -O2 will produce binaries that load quicker than O3. I won't use -Os because it doesn't align functions, loops, and jumps, which I can see as improving performance greatly.
2) -malign-double seems to align doubles in a more favorable fashion, and possibly make retrieving them faster
3) -ffast-math I can't see it increasing size, just speed, so I'll try it
4) -fforce-addr and -fforce-mem seem so intuitive to me. Since register-to-register operations are always faster than memory-to-memory, it makes sense to copy operands into registers, do the work, and then put the result back in RAM.
5) -fomit-frame-pointer, some packages don't like it, but most do. This will really help free up an extra register
6) -mnopush-args, I think the code increase is pretty much not considerable, and may be faster in rare cases
7) I'm dropping -maccumulate-outgoing-args, because while fast, it gives a large increase in code size, so I think this may cause more harm than good.

In general, I believe that these test flags will be a good balance between speed/size.

I think though, that we are going to see that there is no good set of optimizations. I think it varies greatly for each program. I think that in the long run we'll find it best to use the "least common denominator" for overall best average speed. I think the best thing is to change CFLAGS for each individual package, but this would take forever!

jcm
Desktop:
Athlon64 3000+ (Socket 939 Venice)
Asus A8N-SLI
1GB Dual-Channel DDR 3200
NVidia Geforce 6800 256MB

Laptop:
IBM R40
Pentium M 1.4 GHz
256 MB RAM
Top
Post Reply
  • Print view

35 posts
  • Previous
  • 1
  • 2

Return to “Gentoo Chat”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic