Re: __attribute__((always_inline)) fiasco

From: Albert Cahalan
Date: Thu Sep 23 2004 - 12:57:41 EST


On Thu, 2004-09-23 at 12:54, Richard Henderson wrote:
> On Thu, Sep 23, 2004 at 12:26:18PM -0400, Albert Cahalan wrote:
> > Are benchmarks significantly affected if you remove the inline?
>
> The routines in question expand to exactly one instruction.

Fine, but that's not what I asked.

I asked if it shows up on benchmarks. It doesn't, does it?

Supposing that it does, then you might use the
alternate instruction replacement trick for this.
That will beat function pointers for speed.

Also, a simple conditional branch might be better
predicted than a function pointer anyway. At least
it will be close.

So you have at least four reasonable choices:

a. don't inline at all
b. have an uninline_foo() version for each foo
c. instruction replacement
d. simple conditional

The simple choices are better, unless you have
benchmarks (whole system ones) that show otherwise.


-
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/