[FFmpeg-devel] [PATCH] avutil/md5: inline function, 2% speedup

Michael Niedermayer michaelni at gmx.at
Mon May 20 22:29:38 CEST 2013


On Mon, May 20, 2013 at 09:43:07PM +0200, Giorgio Vazzana wrote:
> 2013/5/20 Michael Niedermayer <michaelni at gmx.at>:
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavutil/md5.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavutil/md5.c b/libavutil/md5.c
> > index e3c4981..2df37cc 100644
> > --- a/libavutil/md5.c
> > +++ b/libavutil/md5.c
> > @@ -92,7 +92,7 @@ static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32)
> >          a = b + (a << t | a >> (32 - t));                               \
> >      } while (0)
> >
> > -static void body(uint32_t ABCD[4], uint32_t X[16])
> > +static av_always_inline void body(uint32_t ABCD[4], uint32_t X[16])
> >  {
> >      int i av_unused;
> >      uint32_t t;
> > --
> 
> On my pc I get:
> 
> AMD Athlon(tm) II X3 450 Processor
> 
> # git head
> size: 1048576  runs: 1024  time:    5.660 +- 0.023
> size: 1048576  runs: 1024  time:    5.661 +- 0.030
> size: 1048576  runs: 1024  time:    5.656 +- 0.022
> size: 1048576  runs: 1024  time:    5.647 +- 0.026
> 
> # patch "av_always_inline"
> size: 1048576  runs: 1024  time:    5.523 +- 0.027
> size: 1048576  runs: 1024  time:    5.527 +- 0.032
> size: 1048576  runs: 1024  time:    5.525 +- 0.032
> size: 1048576  runs: 1024  time:    5.519 +- 0.024
> 
> But what about something like the attached patch? It seems to run faster here:
> 

> # patch "nblocks"
> size: 1048576  runs: 1024  time:    5.428 +- 0.037
> size: 1048576  runs: 1024  time:    5.426 +- 0.034
> size: 1048576  runs: 1024  time:    5.426 +- 0.034
> size: 1048576  runs: 1024  time:    5.428 +- 0.038

applied

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130520/94373a9c/attachment.asc>


More information about the ffmpeg-devel mailing list