[FFmpeg-devel] [PATCH] avcodec/mpegaudio_tablegen: more dynamic initialization speedups

Michael Niedermayer michaelni at gmx.at
Sat Nov 28 10:41:22 CET 2015


On Sat, Nov 28, 2015 at 12:46:31AM -0500, Ganesh Ajjanagadde wrote:
> This further speeds up runtime initialization, with identical generated tables.
> 
> Sample benchmark (x86-64, Haswell, GNU/Linux):
> 
> old:
> 34441423 decicycles in mpegaudio_tableinit,    8192 runs,      0 skips
> 
> new:
> 10776291 decicycles in mpegaudio_tableinit,    8192 runs,      0 skips
> 
> Most low hanging fruit is taken care of here. For some idea, note that
> 83,064 array elements totalling 233,722 bytes need to be initialized.
> Thus, with this patch, we average ~ 12.9 cycles per element or ~ 4.6
> cycles per byte.
> 
> I personally consider this net ~ 10x and overall perf numbers sufficient
> for using dynamic initialization all the time here, especially since the
> tables are large.
> 
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> -------------------------------------------------------------------------------
> The reason this is being posted before pushing in the other one is that if
> people agree to do dynamic initialization here, the introduction of avutil/tablegen
> can be deferred to a future date.
> 
> Note that if one had a ~8000 element static lut for the pow_43 values,
> one can bring down the cost slightly, to ~ 8-10 cycles per element but not more,
> so definitely not an order of improvement like the current patches.
> I personally do not like this "middle path" as I find it too complex for a slight
> speed gain, while still having a large ~ 64,000 byte size cost.
> -------------------------------------------------------------------------------
>  libavcodec/mpegaudio_tablegen.h | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h
> index dd67a09..91b29cb 100644
> --- a/libavcodec/mpegaudio_tablegen.h
> +++ b/libavcodec/mpegaudio_tablegen.h

seems this doesnt apply

Applying: avcodec/mpegaudio_tablegen: more dynamic initialization speedups
Using index info to reconstruct a base tree...
error: patch failed: libavcodec/mpegaudio_tablegen.h:45
error: libavcodec/mpegaudio_tablegen.h: patch does not apply
Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Cannot fall back to three-way merge.
Patch failed at 0001 avcodec/mpegaudio_tablegen: more dynamic initialization speedups
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151128/886aa457/attachment.sig>


More information about the ffmpeg-devel mailing list