|
back to index libmpdec decimal benchmarks multi precision benchmarks Python/Java benchmarks |
This benchmark compares libmpdec, apfloat and mpfr. Both libmpdec and apfloat use a power of ten base, so it is no surprise that mpfr leads every benchmark with respect to pure calculation time [1]. However, when the result of a large calculation needs to be converted to decimal, libmpdec and apfloat are faster. To show this, the multiplication benchmarks have been split into calculation + conversion time. All other benchmarks are calculation time only.
| func/prec/iter | libmpdec | apfloat | mpfr |
| mul/5000/1 | 0.00s + 0.00s | 0.00s + 0.00s | 0.00s + 0.00s |
| mul/100000/1 | 0.02s + 0.00s | 0.01s + 0.01s | 0.01s + 0.02s |
| mul/1000000/1 | 0.14s + 0.03s | 0.19s + 0.03s | 0.04s + 0.75s |
| mul/10000000/1 | 2.32s + 0.26s | 2.96s + 0.35s | 0.64s + 17.44s |
| mul/100000000/1 | 20.59s + 2.65s | 32.59s + 3.40s | 8.56s + 328.59s |
| div/5000/1 | 0.01s | 0.00s | 0.00s |
| div/100000/1 | 0.04s | 0.05s | 0.02s |
| div/1000000/1 | 0.62s | 0.51s | 0.16s |
| div/10000000/1 | 7.59s | 7.91s | 2.85s |
| div/100000000/1 | 75.98s | 88.64s | 49.14s |
| sqrt/9/100000 | 0.18s | - | 0.01s |
| sqrt/19/100000 | 0.26s | - | 0.01s |
| sqrt/38/100000 | 0.36s | 0.72s | 0.02s |
| sqrt/1000000/1 | 1.59s[2] | 0.82s | 0.13s |
| sqrt/10000000/1 | 22.50s | 12.67s | 2.31s |
| invroot/1000000/1 | 0.62s | 0.64s | 0.11s |
| invroot/10000000/1 | 8.44s | 9.79s | 1.54s |
| exp/9/100000 | 0.73s | - | 0.45s |
| exp/19/100000 | 1.21s | - | 0.65s |
| exp/38/100000 | 2.16s | 70.96s[3] | 1.71s |
| exp/5000/1 | 1.04s | 0.62s | 0.01s |
| ln/9/100000 | 1.27s | - | 0.25s |
| ln/19/100000 | 2.00s | - | 0.28s |
| ln/38/100000 | 3.30s | 20.90s[3] | 0.48s |
| ln/5000/1 | 2.25s | 0.20s | 0.01s |