[FFmpeg-devel] Trans.: a64multienc.c and drawutils.c optimisations
nicolas.george at normalesup.org
Wed Dec 28 16:07:44 CET 2011
L'octidi 8 nivôse, an CCXX, Stefano Sabatini a écrit :
> Function calls are expensive, so we should avoid them when they are
> not strictly necessary, even if in this case the call is not very
> performance critical, and I like a simple code path, in other words
> you can put the code in the switch without wrapping it around exported
> functions, especially if they are not going to be used in other parts
> of the project.
Non-crappy compilers will always inline function called only once. As for
the simpler code path, this really is a matter of taste: speaking only for
myself, if there is a part of the code that performs a well-delimited task,
I like it much better in a separate function. That way, if you need to
understand the code, you can separate it more easily: first understand what
the function does, and how it does it. And then understand what the calling
code does. Splitting that way has also the merit of raising the odds that
the code fits in a single page of text, avoiding the need for scrolling.
In this particular case, I find the version with memsetXX much more readable
than would be the same with inlined code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel