Message ID | 1465485217-7678-2-git-send-email-diego@biurrun.de |
---|---|
State | Superseded |
Headers | show |
On 09/06/16 17:11, Diego Biurrun wrote: > From: Alexandra Hájková <alexandra@khirnov.net> > > --- > doc/APIchanges | 3 +++ > libavutil/attributes.h | 6 ++++++ > libavutil/version.h | 2 +- > 3 files changed, 10 insertions(+), 1 deletion(-) > Still OK.
Quoting Diego Biurrun (2016-06-09 17:11:43) > From: Alexandra Hájková <alexandra@khirnov.net> > > --- > doc/APIchanges | 3 +++ > libavutil/attributes.h | 6 ++++++ > libavutil/version.h | 2 +- > 3 files changed, 10 insertions(+), 1 deletion(-) > My tests on x86 (haswell refresh, gcc 5.4) show that this makes things significantly slower for dnxhd (didn't test anything else yet). With the current set, 32bit builds with the new reader are about 10% slower than the old one. If I completely drop av_unlikely, the new reader is only about 1% slower.
Ok, it seems the improvement is quite dependent on the compiler version. I did some more measurements and the results are quite ambiguous. The tests all decode a 1080p 175M dnxhd file on an i7-4770K. The following table shows the change in overall decoding performance (as measured by perf stat averaged over 10 runs): new | new without unlikely -------------------------------------------- 32bit gcc 4.9 | -9.4% | -11.2% 32bit gcc 5.4 | -8.4% | -0.9% 32bit gcc 6.1 | -4.9% | -2.6% 32bit clang 3.6 | -8.1% | -8.4% 64bit gcc 4.9 | +20.7% | +21.5% 64bit gcc 5.4 | +20.6% | +22.0% 64bit gcc 6.1 | +22.1% | +22.5% 64bit clang 3.6 | +13.3% | +13.2% Full perf output from those runs is attached if anyone wants to see it.
On Sun, Jun 12, 2016 at 12:28 PM, Anton Khirnov <anton@khirnov.net> wrote: > Ok, it seems the improvement is quite dependent on the compiler version. > I did some more measurements and the results are quite ambiguous. > The tests all decode a 1080p 175M dnxhd file on an i7-4770K. The > following table shows the change in overall decoding performance (as > measured by perf stat averaged over 10 runs): > > new | new without unlikely > -------------------------------------------- > 32bit gcc 4.9 | -9.4% | -11.2% > 32bit gcc 5.4 | -8.4% | -0.9% > 32bit gcc 6.1 | -4.9% | -2.6% > 32bit clang 3.6 | -8.1% | -8.4% > 64bit gcc 4.9 | +20.7% | +21.5% > 64bit gcc 5.4 | +20.6% | +22.0% > 64bit gcc 6.1 | +22.1% | +22.5% > 64bit clang 3.6 | +13.3% | +13.2% > > Full perf output from those runs is attached if anyone wants to see it. > The interesting question would be, how much impact does not having unlikely have on other codecs? - Hendrik
On 12/06/16 12:28, Anton Khirnov wrote: > Ok, it seems the improvement is quite dependent on the compiler version. > I did some more measurements and the results are quite ambiguous. > The tests all decode a 1080p 175M dnxhd file on an i7-4770K. The > following table shows the change in overall decoding performance (as > measured by perf stat averaged over 10 runs): > Thus we can drop it and add it back once the compilers are less fluctuating. lu
Quoting Hendrik Leppkes (2016-06-12 12:46:12) > On Sun, Jun 12, 2016 at 12:28 PM, Anton Khirnov <anton@khirnov.net> wrote: > > Ok, it seems the improvement is quite dependent on the compiler version. > > I did some more measurements and the results are quite ambiguous. > > The tests all decode a 1080p 175M dnxhd file on an i7-4770K. The > > following table shows the change in overall decoding performance (as > > measured by perf stat averaged over 10 runs): > > > > new | new without unlikely > > -------------------------------------------- > > 32bit gcc 4.9 | -9.4% | -11.2% > > 32bit gcc 5.4 | -8.4% | -0.9% > > 32bit gcc 6.1 | -4.9% | -2.6% > > 32bit clang 3.6 | -8.1% | -8.4% > > 64bit gcc 4.9 | +20.7% | +21.5% > > 64bit gcc 5.4 | +20.6% | +22.0% > > 64bit gcc 6.1 | +22.1% | +22.5% > > 64bit clang 3.6 | +13.3% | +13.2% > > > > Full perf output from those runs is attached if anyone wants to see it. > > > > The interesting question would be, how much impact does not having > unlikely have on other codecs? Here is the same table for prores: new | new without unlikely -------------------------------------------------- 32bit gcc 4.9 | +8.5% | 0.0% 32bit gcc 5.4 | -0.3% | +4.4% 32bit gcc 6.1 | -0.2% | +1.0% 32bit clang 3.6 | -0.4% | -0.5% 64bit gcc 4.9 | +14.4% | +7.6% 64bit gcc 5.4 | +13.8% | +11.8% 64bit gcc 6.1 | +14.6% | +13.6% 64bit clang 3.6 | -2.2% | -2.2% I might make more as time allows, but other people are welcome to do their own measurements.
diff --git a/doc/APIchanges b/doc/APIchanges index 9f46edc..36889ba 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2015-08-28 API changes, most recent first: +2016-xx-xx - xxxxxxx - lavu 55.14.0 - attributes.h + Add av_unlikely macro. + 2016-xx-xx - xxxxxxx - lavu 55.13.0 - hwcontext.h Add av_hwdevice_ctx_create(). diff --git a/libavutil/attributes.h b/libavutil/attributes.h index d7f2bb5..1a8d738 100644 --- a/libavutil/attributes.h +++ b/libavutil/attributes.h @@ -123,4 +123,10 @@ # define av_noreturn #endif +#if AV_GCC_VERSION_AT_LEAST(4,3) +# define av_unlikely(x) __builtin_expect((x) != 0, 0) +#else +# define av_unlikely(x) x +#endif + #endif /* AVUTIL_ATTRIBUTES_H */ diff --git a/libavutil/version.h b/libavutil/version.h index 48a5878..7ea434e 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -54,7 +54,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 13 +#define LIBAVUTIL_VERSION_MINOR 14 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
From: Alexandra Hájková <alexandra@khirnov.net> --- doc/APIchanges | 3 +++ libavutil/attributes.h | 6 ++++++ libavutil/version.h | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-)