Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-04-2004, 10:21 PM
|
#1
|
LQ Guru
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672
Rep:
|
advice on -O optimisations for different parts of gentoo ?
Hello guys and girls.
if for a learning experiance, and a little nerdy fun more that anything else, i want to attempt to get my gentoo operating system running as fast as possible.
i intent to re-install it from scratch, configureing optimisation flags for different areas of the system.
here is my understanding of the optimisation flags...
-O1 = use when compile time is an issue.
-O2 = a nice default middle ground.
-O3 = use when binary size is not an issue.
-Os = use for non cpu intensive programs, for small binary sizes.
i was thinking, that i should compile KDE and the QT library with '-Os' because KDE arely uses much CPU, and having a smaller binary size means KDE, and its programs will load faster.. am i not correct ?
i was also thinking, i should compile Xorg with -O3. because X is very cpu intensive when im running games.
also if possible, i should compile the kernel with -O3.
however, im unsure how to compile things like Glibc 'emerge system'
maybe -O3 for speed, since almost everything uses GLIBC.
or maybe, -Os because although glibc and otther librarys are used by almost everything, they are not used much in cpu intensive loops.... also to make it load faster ?
and most other things with '-O2' for a compromise.
what are your opinions ?
|
|
|
08-05-2004, 01:17 AM
|
#2
|
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246
Rep:
|
That's a hell of an undertaking. First and foremost, I wouldn't dare touch the way the kernel is compiled. The kernel is a very touchy thing and optomizations are known to break things.
Also, compiling with optomizations breaks debugging applications for the most part. If you've ever tried to use gdb to figure out why something crashed using a core file from an optomized application you'd know what I mean. If you're not concerned about using debugging applications and you want smaller binary sizes then you can just strip all your binaries (man strip).
I also wouldn't touch glibc with optomizations. I'd look around online for results from other people trying the same things to see if you can find anything useful from other peoples' experiences.
|
|
|
08-05-2004, 09:11 AM
|
#3
|
LQ Guru
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672
Original Poster
Rep:
|
i thought binaries were automatically stripped after compilation ?
|
|
|
08-05-2004, 10:03 AM
|
#4
|
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246
Rep:
|
Not always. Some packages will call strip on the binary after compilation, but certainly not all.
|
|
|
08-05-2004, 01:22 PM
|
#5
|
Senior Member
Registered: Jun 2004
Posts: 2,553
Rep:
|
hi,
(this is just eduated opinion)
it's not quite that complicated
don't optimize glibc or gcc or they will be broken
do optimize the kernel like crazy even get the patches and compile the kernel with icc if you have P4
beyond that never use -g so you don't get those awfull debugging symbols
and use -O3 on EVERYTHING else along with whatever other flags make your system run best like
-funroll-loops -ftracer -momit-leaf-frame-pointer -fprefetch-loop-arrays
very important to use -march fag for your system
(do basic benchmarking to figure out whats best) and don't rely on gcc mythology (gentoo folks seemed to have developed alot of myth about gcc flags)
basically everything runs faster with agressive optimizations
otherwie it's to do benchmarking app by app and the -Ox flag sets are out and you actually have to try all possible combinations to get what is actually best which is imposible.
the gentoo people often recomand -Os but i think they have not done benchmarking and looked at the results of that or they wouldn't say it. Size really doesn't matter.
also when you are done do prelinking
and everything will be zoom zoom
(some thing either wont compile or won't run right done like this so sometimes you have to redo things with the flags that come in the package)
The kernel is absolutely the most important thing to optomize
|
|
|
08-06-2004, 09:52 AM
|
#6
|
LQ Guru
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672
Original Poster
Rep:
|
thanks....
Prelinking ? whats that. ive never heard of that before.
anyways, thanks.
i did some benchmarking of my own, i used an Artifical inteligence program i wrote. No optimisation caused it to complete in 16 seconds, -O1 knocked it down to 7, -O2 down to 6.5 -O3 down to 6, and -Os down to 6.5.. same as -O2 but a few kilobytes smaller in size.
i was tempted to use -Os to reduce the time it takes to load the binaries off the disk.
so far, ive setup my use flags, to link againsed only what i need, and my CFLAGS are -O3 -march=athlon -pipe -fomit-frame-pointer.
im pretty sure -funroll-loops is part of -O3, (which is why -O3 results in larger binary sizes) anyways, thanks for the help... im currently bootstrapping, and posting this in 'links' its the first time ive used a command line web browser, i have to say im quite impressed. bt having trouble loging onto developerfusion.com
|
|
|
08-06-2004, 06:27 PM
|
#7
|
Senior Member
Registered: Jun 2004
Posts: 2,553
Rep:
|
to eliminate any doubt about what is or is not in -O3
also a subject that has drifted into mythology
took at gcc source code file toplev.c
line 4847 and down
the section starts with
Gentoo Prelink Guide
|
|
|
All times are GMT -5. The time now is 06:51 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|