[PATCH] Split mantissa calculation loop and add branch prediction to mp multiplication

Andreas Jaeger aj@suse.com
Mon Dec 31 10:33:00 GMT 2012


On 12/31/2012 10:28 AM, Siddhesh Poyarekar wrote:
> Hi,
>
> The loop inside __mul in mpa.c is slow because of the branch
> evaluation within the loop.  Attached patch splits the loop to make
> the loop simpler to evaluate and also adds some branch prediction to
> improve performance.  I have verified that this does not break the
> testsuite.
>
> I checked for performance improvement with this patch using the test
> program here:
>
> http://entropymine.com/imageworsener/slowpow/
>
> with the following commandline:
>
> time ./powtest 1000000 1.0000000000000020 1.5000000000500000
>
> Taking into account the best times with and without the patch (with
> more than 10 runs each), the improvement is about a quarter of a
> second.

What's the percentage? 0.25s can be a lot - or very little depending on 
the total run time.

Andreas

-- 
  Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
   SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
    GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
     GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126



More information about the Libc-alpha mailing list