At 04:37 PM 8/1/00 -0400, John Tobey wrote:
>Dan Sugalski <[EMAIL PROTECTED]> wrote:
> > (FWIW, it seems on many of the modern
> > processors that inlining code decreases your performance, so I think
> > deciding on stuff like that is rather premature)
>
>Is foo() compiled any differently in
>
> inline i_foo() { BLA; BLA; BLA; }
> foo() { i_foo(); }
>
>versus
>
> foo() { BLA; BLA; BLA; }
>
>?
Probably. On many newer chips, the first form will probably get you a
function called i_foo and foo will call it, rather than actually inlining
the code. (Depends on how often i_foo is called) Function calls are
reasonably cheap, and if you have one copy of the function instead of many,
it may well be in the cache already, where it wouldn't be in the inlined case.
Given that some of the faster machines take a 10x speed hit getting to main
memory, that can make a *big* difference.
(FWIW, I was thinking of the difference between #define-ing a function and
just declaring it--I'd forgotten about the inline keyword)
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk