Re: Code optimization <LEA Instruction>

From: Jamie Lokier (lkd@tantalophile.demon.co.uk)
Date: Sun Jan 30 2000 - 11:29:08 EST


Jeffrey B. Siegal wrote:
> > On Crusoe I guess the cost of redundant instructions is not so
> > significant once they've been through a translation pass, but for those
> > instruction streams getting interpreted, and for the speed of
> > translation itself, it still makes sense to keep the number of
> > instructions (and their size) to a minimum.
>
> Which, interestingly, suggests that -Os (or something like it) is what you
> want.

Not necessarily. The smallest instructions tend to be more complicated
and expand to more basic operations, so decoding cost _may_ be reduced,
but the next step in translation, and the area used in the cache, and
the execution time, may be longer.

> On the other hand, inlining, as a tradeoff of size for speed, might actually
> be bad (the out-of-line function can get translated once, but inline it needs
> to get translated at each call-site).

That's one of the wonders of dynamic profiling. (Which, btw, you can
do at a bounded arbitrarily low cost if you're prepared to forget about
caches ;-) You decide when to inline based on whether its worth it in
each situation.

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:25 EST