in reply to Re: Re: Optimizing into the Weird Zone
in thread Optimizing into the Weird Zone

I've studied some hand- optimized ASM compared to the output of GCC, and while the hand-optimized can shave off an instruction or two, it will suffer more if the processor makes a branch misprediction.

That just means the guys that optimised the code generators of the GCC compiler did an excellent job.

So all in all, its better if programmers leave that stuff alone if we can get away with it.

I bet everyone who uses the GCC compiler is glad that it's programmers didn't take a hands-off attitude.

I guess it comes down where in the food chain your code comes. If you know it will always be top predator--consuming memory and cycles--then you can afford to apply no bounds, nor waste effort trying to curtail its appitite. However, if your code needs to live in a competative environment sharing limited resources, and especially if your code lives only part way up the food chain (ie. libraries and modules), then your efforts to limit the consumption by your code will have knock on benefits for every run of every top predator written to use it.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.

  • Comment on Re: Re: Re: Optimizing into the Weird Zone

Replies are listed 'Best First'.
Re: Re: Re: Re: Optimizing into the Weird Zone
by hardburn (Abbot) on Aug 12, 2003 at 20:24 UTC

    That just means the guys that optimised the code generators of the GCC compiler did an excellent job.

    I bet everyone who uses the GCC compiler is glad that it's programmers didn't take a hands-off attitude.

    Yup. The GCC people work hard so the rest of us don't have to.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated