Re: [FFmpeg-devel] [PATCH 2/3] lavu/rational: use av_unlikely in av_d2q

2016-02-27 Thread Ganesh Ajjanagadde
On Thu, Feb 25, 2016 at 7:25 AM, Nicolas George  wrote:
> Le sextidi 6 ventôse, an CCXXIV, Ganesh Ajjanagadde a écrit :
>> Actual performance benefit is impossible to accurately quantify due to the
>> context-dependence of the branch predictor. Nonetheless, as a ballpark
>> estimate, it yields ~ 5% improvements in testing via FATE on x86-64, 
>> Haswell+GCC.
>
> Five percent is huge, if it is five percent of something relevant. Can you
> give a few more details?

Ok, here are the benches I obtained, make fate lavf-ffm, START/STOP
around body of av_d2q. Platform: Haswell+GCC under -march=native.
Naive stream_loop does not increase the iteration count unfortunately.
As for av_d2q's relevance, max call count on any FATE test is 16 or 32
IIRC.

old:
  74040 decicycles in av_d2q,   1 runs,  0 skips
  39480 decicycles in av_d2q,   2 runs,  0 skips
  21385 decicycles in av_d2q,   4 runs,  0 skips
[...]
  13235 decicycles in av_d2q,   8 runs,  0 skips
[...]
   7571 decicycles in av_d2q,  16 runs,  0 skips

new:
  68660 decicycles in av_d2q,   1 runs,  0 skips
  36410 decicycles in av_d2q,   2 runs,  0 skips
  19815 decicycles in av_d2q,   4 runs,  0 skips
[...]
  12355 decicycles in av_d2q,   8 runs,  0 skips
[...]
   7080 decicycles in av_d2q,  16 runs,  0 skips

>
> Regards,
>
> --
>   Nicolas George
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] lavu/rational: use av_unlikely in av_d2q

2016-02-25 Thread Nicolas George
Le sextidi 6 ventôse, an CCXXIV, Ganesh Ajjanagadde a écrit :
> Actual performance benefit is impossible to accurately quantify due to the
> context-dependence of the branch predictor. Nonetheless, as a ballpark
> estimate, it yields ~ 5% improvements in testing via FATE on x86-64, 
> Haswell+GCC.

Five percent is huge, if it is five percent of something relevant. Can you
give a few more details?

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/3] lavu/rational: use av_unlikely in av_d2q

2016-02-24 Thread Ganesh Ajjanagadde
From: Ganesh Ajjanagadde 

Merely a simple illustration of av_unlikely's utility; there are
certainly more interesting use cases.

Actual performance benefit is impossible to accurately quantify due to the
context-dependence of the branch predictor. Nonetheless, as a ballpark
estimate, it yields ~ 5% improvements in testing via FATE on x86-64, 
Haswell+GCC.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavutil/rational.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/rational.c b/libavutil/rational.c
index 6b3f50a..3e841ad 100644
--- a/libavutil/rational.c
+++ b/libavutil/rational.c
@@ -108,9 +108,9 @@ AVRational av_d2q(double d, int max)
 AVRational a;
 int exponent;
 int64_t den;
-if (isnan(d))
+if (av_unlikely(isnan(d)))
 return (AVRational) { 0,0 };
-if (fabs(d) > INT_MAX + 3LL)
+if (av_unlikely(fabs(d) > INT_MAX + 3LL))
 return (AVRational) { d < 0 ? -1 : 1, 0 };
 frexp(d, &exponent);
 exponent = FFMAX(exponent-1, 0);
-- 
2.7.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel