Boost logo

Boost :

Subject: Re: [boost] Looking for some "real world" extended precision integer arithmetic tests
From: John Maddock (boost.regex_at_[hidden])
Date: 2012-03-21 13:17:18


Andrii,

Many thanks for the use case - in point of fact it's proved pretty hard to
get a general purpose solution anywhere near your special-purpose code -
simply because your code is so simple ;-) In the general purpose case, even
something as simple as an extra "if" statement can make a big difference in
your benchmarks, largely because they mainly test construction of
temporaries!

Anyhow, I think I'm as close as it's going to get for now, here it is on
Linux (sorry about the mangled names, but your integer type is first):

Testing... N5boost7polygon6detail12extended_intILm32EEE
Voronoi Benchmark Test (time in seconds):
| Number of points | Number of tests | Time per one test |
| 10 | 10000 | 0.000035 |
| 100 | 1000 | 0.000620 |
| 1000 | 100 | 0.006900 |
| 10000 | 10 | 0.087000 |
| 100000 | 1 | 0.880000 |
Testing...
N5boost14multiprecision9mp_numberINS0_8backends15cpp_int_backendILj256ELb1EvEELb1EEE
Voronoi Benchmark Test (time in seconds):
| Number of points | Number of tests | Time per one test |
| 10 | 10000 | 0.000041 |
| 100 | 1000 | 0.000720 |
| 1000 | 100 | 0.008200 |
| 10000 | 10 | 0.097000 |
| 100000 | 1 | 1.010000 |
Testing...
N5boost14multiprecision9mp_numberINS0_8backends15cpp_int_backendILj1024ELb1EvEELb1EEE
Voronoi Benchmark Test (time in seconds):
| Number of points | Number of tests | Time per one test |
| 10 | 10000 | 0.000041 |
| 100 | 1000 | 0.000730 |
| 1000 | 100 | 0.008100 |
| 10000 | 10 | 0.097000 |
| 100000 | 1 | 1.000000 |
Testing...
N5boost14multiprecision9mp_numberINS0_8backends15cpp_int_backendILj0ELb1ESaImEEELb1EEE
Voronoi Benchmark Test (time in seconds):
| Number of points | Number of tests | Time per one test |
| 10 | 10000 | 0.000052 |
| 100 | 1000 | 0.000930 |
| 1000 | 100 | 0.010300 |
| 10000 | 10 | 0.121000 |
| 100000 | 1 | 1.240000 |
Testing... N5boost14multiprecision9mp_numberINS0_8backends7gmp_intELb1EEE
Voronoi Benchmark Test (time in seconds):
| Number of points | Number of tests | Time per one test |
| 10 | 10000 | 0.000075 |
| 100 | 1000 | 0.001400 |
| 1000 | 100 | 0.015500 |
| 10000 | 10 | 0.174000 |
| 100000 | 1 | 1.780000 |
Testing...
N5boost14multiprecision9mp_numberINS0_8backends11tommath_intELb1EEE
Voronoi Benchmark Test (time in seconds):
| Number of points | Number of tests | Time per one test |
| 10 | 10000 | 0.001447 |
| 100 | 1000 | 0.026940 |
| 1000 | 100 | 0.269500 |
| 10000 | 10 | 2.590000 |
| 100000 | 1 | 24.870000 |

On Windows, I can't get quite as close, and MPIR on Win32 is noticeably much
much worse than GMP on Linux x64:

Testing... class boost::polygon::detail::extended_int<32>
Voronoi Benchmark Test (time in seconds):
| Number of points | Number of tests | Time per one test |
| 10 | 10000 | 0.000072 |
| 100 | 1000 | 0.001117 |
| 1000 | 100 | 0.012220 |
| 10000 | 10 | 0.134600 |
| 100000 | 1 | 1.377000 |
Testing... class boost::multiprecision::mp_number<struct
boost::multiprecision::backends::cpp_int_backend<1024,1,void>,0>
Voronoi Benchmark Test (time in seconds):
| Number of points | Number of tests | Time per one test |
| 10 | 10000 | 0.000094 |
| 100 | 1000 | 0.001601 |
| 1000 | 100 | 0.017600 |
| 10000 | 10 | 0.187100 |
| 100000 | 1 | 1.893000 |
Testing... class boost::multiprecision::mp_number<struct
boost::multiprecision::backends::cpp_int_backend<1024,1,void>,1>
Voronoi Benchmark Test (time in seconds):
| Number of points | Number of tests | Time per one test |
| 10 | 10000 | 0.000104 |
| 100 | 1000 | 0.001693 |
| 1000 | 100 | 0.018740 |
| 10000 | 10 | 0.196900 |
| 100000 | 1 | 1.988000 |
Testing... class boost::multiprecision::mp_number<struct
boost::multiprecision::backends::cpp_int_backend<0,1,class
std::allocator<unsigned int> >,1>
Voronoi Benchmark Test (time in seconds):
| Number of points | Number of tests | Time per one test |
| 10 | 10000 | 0.000126 |
| 100 | 1000 | 0.002210 |
| 1000 | 100 | 0.024230 |
| 10000 | 10 | 0.254400 |
| 100000 | 1 | 2.563000 |
Testing... class boost::multiprecision::mp_number<struct
boost::multiprecision::backends::gmp_int,1>
Voronoi Benchmark Test (time in seconds):
| Number of points | Number of tests | Time per one test |
| 10 | 10000 | 0.000392 |
| 100 | 1000 | 0.007060 |
| 1000 | 100 | 0.078010 |
| 10000 | 10 | 0.803300 |
| 100000 | 1 | 8.080000 |

Cheers, John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk