[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mplayer



Hi, Billy Biggs wrote:

> Maybe you'd like to educate us on how to select optimized routines at
> runtime without penalties.

You can't- You can, however, select them in such a way that it's no
problem.

>  I know that in my application I have
> gratuitous use of function pointers to deal with this.

Define "gratuitous". You can dynamically load a library with the most
speedful implementation for your hardware, thus you can hide the function
pointer in the linker and replace them by an additional jump instruction.

>  What do you
> recommend I do to avoid that penalty?

Optimized code typically runs for far longer than the dereferencing of a
function pointer takes, so in terms of speed there simply isn't any.

If the function-pointerized code just looks ugly, the C preprocessor is
your friend -- on the other hand you don't even need that, as foo(bar,...)
is equivalent to (*foo)(bar,...) if foo is a pointer to a function.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
-- 
System restarting, wait...



Reply to: