[MPFR] multiplications vs. subtractions: which one is faster?
Paul.Zimmermann at loria.fr
Sun Jul 15 10:54:03 CEST 2007
> Here are some benchmarks of MPFR 2.2.1 on Pentium M with prec=3000
> mpfr_sub: 553 / 607.50 / 818
> mpfr_mul: 26572 / 26906.87 / 27175
> mpfr_add: 551 / 594.00 / 799
> Subtraction version: 6400*607=3,884,800 ticks
> Multiplication version: 138*594+138*26906 = 3,795,000 ticks
> Taking into account the cache and the branch prediction, I think both
> versions are equal.
> If you reduce the precision, the multiplication version should be
> faster, whereas the subtraction version should be faster if you
> increase it.
Thank you Patrick. However I'd like to point out that those figures (I mean
the ratio of the number of cycles for both variants) might vary from one
platform to the other, maybe by more than a factor of two. They might also
depend on the version of mpfr, on the fact that GMP and/or MPFR were tuned
for that platform, and on the actual operand values (in particular mpfr_sub
might be slower when subtracting numbers that are very close).
More information about the gmp-discuss