LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 06-18-2005, 12:17 AM   #1
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Rep: Reputation: 35
How to compile apps to achieve maximum performance?


Should I pass any options to "./configure" script?
Or what should I do?
Thanks.
 
Old 06-18-2005, 12:19 AM   #2
irfanhab
Member
 
Registered: Jan 2004
Location: Pakistan
Distribution: OpenSuse 10.2, Slackware 11, Solaris 10
Posts: 415

Rep: Reputation: 34
Modify the 'Makefile' before compiling.

I do not know where exactly you put the optimization code, but it is passed to gcc in the form of (for example)

--march=pentium4 which optimizes the compilation for the pentium 4
 
Old 06-18-2005, 12:21 AM   #3
irfanhab
Member
 
Registered: Jan 2004
Location: Pakistan
Distribution: OpenSuse 10.2, Slackware 11, Solaris 10
Posts: 415

Rep: Reputation: 34
for more detail about gcc optimization:
visit
http://helgafell.rhi.hi.is/gcc/gcc_13.html
 
Old 06-18-2005, 03:20 AM   #4
Harmaa Kettu
Member
 
Registered: Apr 2005
Location: Finland
Posts: 196

Rep: Reputation: 30
Most configure scripts take the compiler options from CFLAGS and CXXFLAGS environment variables. Do this before running ./configure (replace "athlon" with your processor type):
Code:
export CFLAGS="-O2 -march=athlon -s -pipe -Wall"
export CXXFLAGS="$CFLAGS"
I have used these settings long enough to know that they are stable. More exotic options will cause problems sooner or later.
 
Old 06-18-2005, 07:53 AM   #5
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
Thanks, irfanhab, Harmaa Kettu.
I'm gonna recompile my Slackware to see if it'll run faster.
 
Old 06-19-2005, 12:33 PM   #6
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 51
just a note

while that -s flag is quite popular smaller binaries do not as a rule run faster

i would do lots of benchmarking before embarking on an optimization mission
and never try to optimize glibc or gcc itself

otherwise you can be really agressive even with the kernel
(the kernel requires altering the Makefile)

stability is not the problem everyone says it is
some packages break but not many and it's quite easy to see as you go along so you can go back and redo
 
Old 06-19-2005, 12:51 PM   #7
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
Thanks for notes, foo_bar_foo.
 
Old 06-19-2005, 02:44 PM   #8
TruckStuff
Member
 
Registered: Apr 2002
Posts: 498

Rep: Reputation: 30
Also note that some packages like GCC and GLibC are known to have issues if the default optimizations are changed. Be very careful with optimizing core components!
 
Old 06-19-2005, 02:53 PM   #9
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 50
Same advice than TruckStuff, be careful, some packages can not work with such optimizations leaving you with errors you can do nothing about.
 
Old 06-19-2005, 10:17 PM   #10
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 51
Quote:
Originally posted by mrcheeks
some packages can not work with such optimizations leaving you with errors you can do nothing about.
you can always go back and recompile anything that doesn't work
it's as easy as doing it the first time only different
you start with
unset CFLAGS
unset CXXFLAGS

like i said these warnings are overblown
i compiled this entire system accept
glibc
gcc
and binutils
with
Code:
export CFLAGS='-march=pentium4 -O3 -funroll-loops -ftracer -momit-leaf-frame-pointer -fprefetch-loop-arrays'
export CXXFLAGS=$CFLAGS
perfectly stable -- zoom zoom
 
Old 06-19-2005, 11:32 PM   #11
Noth
Member
 
Registered: Jun 2005
Distribution: Debian
Posts: 356

Rep: Reputation: 30
http://www.funroll-loops.org/
 
Old 06-19-2005, 11:39 PM   #12
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 50
[QUOTE]Originally posted by foo_bar_foo
[B]you can always go back and recompile anything that doesn't work
it's as easy as doing it the first time only different
you start with
unset CFLAGS
unset CXXFLAGS

Yes you can recompile and i had to do it under freebsd, but i had to track myself which ports i had to recompile to avoid recompiling lots of dependencies...
 
Old 06-20-2005, 01:13 AM   #13
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
Thanks, TruckStuff, mrcheeks, foo_bar_foo, Noth.
 
Old 06-20-2005, 02:52 PM   #14
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 51
Quote:
Originally posted by Noth
http://www.funroll-loops.org/
yes we already know about the racist website and have noticed how some people who have mental problems have to engage in bizarre blaiming activities directed at certain groups in order to feel good about themselves.

i can't really say that it relavent to our discussion.

funroll-loops is a compiler technique whereby loops that have a determinate size are unrolled so the loop data can be moved to and from memory as part of a single cache line prevent mmu cache thrashing.

NORTH if you thing gcc -funroll-loops is not usefull in this way then please provide us with valgrind data to back up your assertion or kindly keep your bizarre opinions to yourself.
 
Old 06-20-2005, 03:00 PM   #15
Noth
Member
 
Registered: Jun 2005
Distribution: Debian
Posts: 356

Rep: Reputation: 30
I don't really see how the site is racist, but I can't say I've read every word on it either. It's a joke, lighten up.

It's relevant because it's a parody of the mindset that a lot of Gentoo users display, claiming that compiling everything from scratch will make the system magically faster. Sure there are some benefits that can be had when you're not compiling packages to support the lowest common denominator, but IMO it's mostly a waste of time. I'd rather use precompiled pacakges that get real QA done on them.

Oh and there's no "R" in my username.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
performance and burn-in apps for OC'ing... Present Linux - Software 1 06-27-2005 10:23 PM
Cannot compile SDL apps godice Linux - Software 2 05-22-2005 09:34 AM
Compile from source - increase in performance? csvke Linux - Software 15 01-18-2005 11:08 PM
How does the compile affect performance claudiup Linux - Software 3 12-11-2004 01:21 PM
Maximum Number of Directory Entries & Performance aig Linux - General 1 07-09-2004 08:36 AM


All times are GMT -5. The time now is 08:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration