Re: Compiler optimizations
On Jan 16, 11:34 am, Randy Howard <randyhow...@FO OverizonBAR.net >
wrote:
GCC aside:
-march is supposed to be a promise of that. If you run it on
something else then you won't get the sort of performance you were
hoping for. Many other compilers have this same sort of effect (even
producing code that will only run on certain CPUs in some instances).
Rats. How deflating.
On Jan 16, 11:34 am, Randy Howard <randyhow...@FO OverizonBAR.net >
wrote:
On Wed, 16 Jan 2008 05:24:07 -0600, Joachim Schmitz wrote
(in article <fmkpgn$v3...@o nline.de>):
>
>
>
>
>
>
>
>
>
>
>
>
If not the compiler/optimizer, who else?
>
How can it possibly know which computer(s) you will install and run it
on after it is compiled?
(in article <fmkpgn$v3...@o nline.de>):
>
>
>
>
>
Kelsey Bjarnason wrote:
On Wed, 16 Jan 2008 00:43:25 +0100, sammy wrote:
>Word up!
>If there are any gcc users here, maybe you could help me out. I have
>a program and I've tried compiling it with -O2 and -O3 optimization
>settings.
>a program and I've tried compiling it with -O2 and -O3 optimization
>settings.
>The wired thing is that it actually runs faster with -O2 than with
>-O3, even though -O3 is a higher optimization setting.
>-O3, even though -O3 is a higher optimization setting.
>Have I found a bug in gcc? Could I be doing something wrong?
One point to ponder, which isn't specific to gcc but to optimisation
in general...
in general...
Many optimisations consume more space than the less optimised code.
Loop unrolling, for example, can do this. While this _can_ result in
faster code, it can _also_ potentially result in side effects such as
exhausting the cache memory. The net result can be a significant
slowdown.
Loop unrolling, for example, can do this. While this _can_ result in
faster code, it can _also_ potentially result in side effects such as
exhausting the cache memory. The net result can be a significant
slowdown.
This sort of thing isn't really a bug; the optimiser has no way to
know what machines the code will run on.
know what machines the code will run on.
How can it possibly know which computer(s) you will install and run it
on after it is compiled?
-march is supposed to be a promise of that. If you run it on
something else then you won't get the sort of performance you were
hoping for. Many other compilers have this same sort of effect (even
producing code that will only run on certain CPUs in some instances).
Not every program is something for you to play with for a bit in ~/src
then forget about. ;-)
then forget about. ;-)
Comment