LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   is optimized software really faster? (https://www.linuxquestions.org/questions/linux-software-2/is-optimized-software-really-faster-294353/)

shanenin 02-24-2005 10:50 AM

is optimized software really faster?
 
If you have a system like gentoo that is optimiized for you specific processor, althon xp in my case. Is this truely faster then a system built with bianaries that are built to run on an i386 machine? I realize in theory they are, but in practice can anyone really tell the difference? Are there any benchmarks that show the difference?

Scorpio 02-24-2005 10:56 AM

Not sure about benchmarks but they would be faster than binaries.
Only bad thing about the optimisation of say gentoo is the compile time.
Especailly on older pcs imo.

Hammett 02-24-2005 12:20 PM

I use Gentoo and since I hit Linux Gentoo 2.6.9 on grub, until Fluxbox is ready, the elapsed time is 1minute....
Before I was using FC3 and it took around 1:35 - 1:40 to start up.

I really think it's way faster, but, as said above, compilation sometimes is endless (took me more than 1h to compile qt libraries)

foo_bar_foo 02-24-2005 12:25 PM

this is only for floating point math so the results are not that significant overall
http://home.comcast.net/~jcunningham...imization.html
his results with athlon xp show roughly 47% increase in speed from
-O3 -march=i386 350 seconds
to
-march=athlon-xp -O3 -ffast-math -malign-double -funroll-loops -pipe -fomit-frame-pointer -msse -mfpmath=sse,387 241 seconds

the results would be even greater if he had used -O2 on the baseline

on my own machine i did tests once and came up with an overall increase of 11% for i/o throughput
but that was just with compiling the test with different flags.

if you were to factor in how much slower it would actually be on a non optimized kernel/non optimized filesystem etc i would imagine it would be at least 25% or greater

shanenin 02-24-2005 12:33 PM

thanks, that is some good information.

Hammett 02-24-2005 12:41 PM

Quote:

Originally posted by foo_bar_foo
this is only for floating point math so the results are not that significant overall
http://home.comcast.net/~jcunningham...imization.html
his results with athlon xp show roughly 47% increase in speed from
-O3 -march=i386 350 seconds
to
-march=athlon-xp -O3 -ffast-math -malign-double -funroll-loops -pipe -fomit-frame-pointer -msse -mfpmath=sse,387 241 seconds

the results would be even greater if he had used -O2 on the baseline

on my own machine i did tests once and came up with an overall increase of 11% for i/o throughput
but that was just with compiling the test with different flags.

if you were to factor in how much slower it would actually be on a non optimized kernel/non optimized filesystem etc i would imagine it would be at least 25% or greater

So, which are the desirabel optimization flags? All of them?? I mean, I'm not a guru in hardware/software and I didn't change that much the optimizations for my arch (-O2 -march=pentium4 -fomit-frame-pointer), so I really don't know if I should put more and more flags to the make.conf file for getting a faster machine or, on the contrary, putting more flags will end up in a mess....

PMorph 02-24-2005 01:43 PM

I'm sure these optimizations can really make a difference in computationally heavy tasks, like 3D rendering, audio/video encoding etc. number crunching.

But I doubt it makes any noticeable difference in the everyday desktop usage, X performance?
Or does it? Anyone?

bulliver 02-24-2005 01:53 PM

I don't think it creates a noticeable difference at all. Don't get me wrong, I use and love gentoo, but not for any supposed speed increase.

I used to be one of those gentoo 'ricers' that used uber-optimized gcc flags, but gave up because of broken builds and unstable software. Now I use a 'sober' -O2

While a .002 second speed increase may be nice in the HPC domain, it is meaningless to your typical end user.

Real gentoo'ers know the reason we use it is because of:
1. choice
2. portage

not any supposed speed increase.

Tinkster 02-24-2005 01:57 PM

Quote:

Originally posted by Hammett
I use Gentoo and since I hit Linux Gentoo 2.6.9 on grub, until Fluxbox is ready, the elapsed time is 1minute....
Before I was using FC3 and it took around 1:35 - 1:40 to start up.

I really think it's way faster, but, as said above, compilation sometimes is endless (took me more than 1h to compile qt libraries)

Heh ... Slackware 8.1 ("optimized" for i386) was booting in 40
seconds on a P4 1.6 ... Mandreck (i586) on the same machine
was booting in 110 ... does that mean that i386 code is faster? Or
do you think it might be due to different services that are being
started and the way the init-scripts work?

As others have pointed out ... it won't have much impact on
everyday work. I noticed a negligable difference in e.g.
video-stream encoding when I recompiled transcode (and
the libs it uses) for -march=pentium4 -msse2 ... encoding
the same video gained just under a minute, which doesn't
make a lot of a difference when you're looking at 7 hours ;)


Cheers,
Tink

rshaw 02-24-2005 02:02 PM

in case anyone missed the 'ricer' reference:
http://funroll-loops.org/ careful, naughty language therein.

__J 02-24-2005 03:02 PM

Quote:

Originally posted by Hammett
So, which are the desirabel optimization flags? All of them?? I mean, I'm not a guru in hardware/software and I didn't change that much the optimizations for my arch (-O2 -march=pentium4 -fomit-frame-pointer), so I really don't know if I should put more and more flags to the make.conf file for getting a faster machine or, on the contrary, putting more flags will end up in a mess....
Too much is a bad thing and can have a negative impact on performance. If you put too many in, you will start to see erratic behavior/crashes from some of your applications.

do a google as there are alot of references out there:

http://home.comcast.net/~jcunningham...ion_Flags.html
http://freshmeat.net/articles/view/730/
http://www.emerson.emory.edu/service...e_Options.html

dastrike 02-24-2005 03:14 PM

Overall: the actual performance increase is not really worth the time spent on recompiling everything with every bell-and-whizbang-"optimization"-settings.

But in specific cases of particular programmes there are noticeable performance increases though.

As with all performance optimization: identify your bottleneck first. Then resolve that bottleneck and move onto the next bottleneck. There are many bottlenecks to fix before one needs to go beyond a plain -O2 optimization during compilation (and in many cases an -O3 just makes the code slower and the executable far more bloated sizewise).

voyciz 02-24-2005 03:19 PM

In the March edition of Linux Journal, a test was conducted with a script that "performs a bubble search over 10,000 elements. The elements in the array have been reversed to force the worst-case scenario". Results:

$ gcc -o sort sort.c -O2
$ time ./sort

real 0m1.036s
user 0m2.030s
sys 0m0.000s

$ gcc -o sort sort.c -O2 -march=pentium2
$ time ./sort

real 0m0.799s
user 0m0.790s
sys 0m0.010s

There was a 237ms (23%) speed increase. The tests were conducted on a 633MHz Celeron. Hope this helps.

sh1ft 02-24-2005 03:33 PM

Im sorry but this gentoo speed increase crap is a bunch of bs. It does nothing to decrease interactivity and latency and is mostly useless on a desktop os. I'd rather wait .0002 seconds longer for firefox to startup then waste 10 hours compiling it. What a waste of time and cpu cycles. The only difference it makes is in programs that occupy the cpu 100% and do caclulation intensive tasks like number crunching and video or music encoding.

In fact for some programs it INCREASES startup time by making the binary bigger.

In the words of Vanilla Ice:

rice rice baby... ;)

bulliver 02-24-2005 04:20 PM

Could have sworn that's what I said 6 posts ago, but a lot more politely.
Stop equating gentoo users with ricers. We're not all boneheads you know.


All times are GMT -5. The time now is 04:16 PM.