mpn_sqrtrem{1,2}

Marco Bodrato bodrato at mail.dm.unipi.it
Wed Mar 8 21:11:32 UTC 2017


Ciao Adrien,

Il 2017-02-16 22:45 Adrien Prost-Boucle ha scritto:
> Here are the results, with vanilla GMP and with floating-point 
> mpn_sqrtrem{1,2}.

> 10000000 times, 128 bits ...... vanilla 1.044 s / FP 0.781 s
> 10000000 times, 100 bits ...... vanilla 1.373 s / FP 1.077 s
> 
> There is some noticeable speedup only for very short bit widths.
> And the speedup is "only" 20-30%.

You are right, there was a too heavy overhead for small operands.

I pushed a patch that shorten the track for operands of two limbs.
( https://gmplib.org/repo/gmp/rev/bba7e03de01a )

The speed-up is noticeable.

Before the patch.
[bodrato at shell ~/gmp-repo/tests/devel]$ time ./sqrtrem_1_2 c
Values of a single limb, tested.
Values with at most a limb for reminder, tested.
Values of at most two limbs, tested.
real	6m39.725s

After the patch.
[bodrato at shell ~/gmp-repo/tests/devel]$ time ./sqrtrem_1_2 c
Values of a single limb, tested.
Values with at most a limb for reminder, tested.
Values of at most two limbs, tested.
real	3m47.247s

I'll be grateful if you run your measures again,
in particular for 100 and 128 bits.

Regards,
m

-- 
https://nonunadimeno.wordpress.com/


More information about the gmp-devel mailing list