LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to compile apps to achieve maximum performance? (https://www.linuxquestions.org/questions/linux-general-1/how-to-compile-apps-to-achieve-maximum-performance-334773/)

kornerr 06-17-2005 11:17 PM

How to compile apps to achieve maximum performance?
 
Should I pass any options to "./configure" script?
Or what should I do?
Thanks.

irfanhab 06-17-2005 11:19 PM

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

irfanhab 06-17-2005 11:21 PM

for more detail about gcc optimization:
visit
http://helgafell.rhi.hi.is/gcc/gcc_13.html

Harmaa Kettu 06-18-2005 02:20 AM

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.

kornerr 06-18-2005 06:53 AM

Thanks, irfanhab, Harmaa Kettu.
I'm gonna recompile my Slackware to see if it'll run faster.

foo_bar_foo 06-19-2005 11:33 AM

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

kornerr 06-19-2005 11:51 AM

Thanks for notes, foo_bar_foo.

TruckStuff 06-19-2005 01:44 PM

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!

mrcheeks 06-19-2005 01:53 PM

Same advice than TruckStuff, be careful, some packages can not work with such optimizations leaving you with errors you can do nothing about.

foo_bar_foo 06-19-2005 09:17 PM

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

Noth 06-19-2005 10:32 PM

http://www.funroll-loops.org/

mrcheeks 06-19-2005 10:39 PM

[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...

kornerr 06-20-2005 12:13 AM

Thanks, TruckStuff, mrcheeks, foo_bar_foo, Noth.

foo_bar_foo 06-20-2005 01:52 PM

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.

Noth 06-20-2005 02:00 PM

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.


All times are GMT -5. The time now is 03:25 PM.