historical micro-optimizations (Re: [PATCH 1/1] fat: improve sync performance by grouping writes revised again)

From: Jörn Engel
Date: Thu Nov 02 2006 - 05:25:39 EST


On Wed, 1 November 2006 15:52:09 -0500, Phillip Susi wrote:
>
> In other words, the only time this micro optimization will be of benefit
> is if you are erroring out most of the time rather than only under
> exceptional conditions, AND the error label isn't too far away for a
> conditional branch to reach. In other words, just don't do it ;)

The difference was in code size, so the icache impact would have
benefitted the good case as well. "was" and "would have" because I
finally got off my lazy arse and tested the code. With gcc 4.12 both
variants compiled to exactly the same code. With 2.95 there was a one
instruction (2 bytes) difference.

I didn't test all the versions in between, but the advantage is
definitely a thing of the past.

And even if the 2 byte difference still existed, it wouldn't really
matter much, we all agree on that. That's why I said:

> >Both methods definitely work. Whether one is preferrable over the
> >other is imo 90% taste and maybe 10% better code on some architecture.
> >So just pick what you prefer.

The only thing I was arguing was that one method would not work - it
does. So I hope this was sufficient distraction for everyone and we
can get back to work. :)

Jörn

--
You can't tell where a program is going to spend its time. Bottlenecks
occur in surprising places, so don't try to second guess and put in a
speed hack until you've proven that's where the bottleneck is.
-- Rob Pike
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/