3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>Integer Real World Tests
</title>
5 <link rel=
"stylesheet" href=
"../../../../../../doc/src/boostbook.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.77.1">
7 <link rel=
"home" href=
"../../index.html" title=
"Chapter 1. Boost.Multiprecision">
8 <link rel=
"up" href=
"../perf.html" title=
"Performance Comparison">
9 <link rel=
"prev" href=
"realworld.html" title=
"Floating-Point Real World Tests">
10 <link rel=
"next" href=
"float_performance.html" title=
"Float Algorithm Performance">
12 <body bgcolor=
"white" text=
"black" link=
"#0000FF" vlink=
"#840084" alink=
"#0000FF">
13 <table cellpadding=
"2" width=
"100%"><tr>
14 <td valign=
"top"><img alt=
"Boost C++ Libraries" width=
"277" height=
"86" src=
"../../../../../../boost.png"></td>
15 <td align=
"center"><a href=
"../../../../../../index.html">Home
</a></td>
16 <td align=
"center"><a href=
"../../../../../../libs/libraries.htm">Libraries
</a></td>
17 <td align=
"center"><a href=
"http://www.boost.org/users/people.html">People
</a></td>
18 <td align=
"center"><a href=
"http://www.boost.org/users/faq.html">FAQ
</a></td>
19 <td align=
"center"><a href=
"../../../../../../more/index.htm">More
</a></td>
22 <div class=
"spirit-nav">
23 <a accesskey=
"p" href=
"realworld.html"><img src=
"../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../perf.html"><img src=
"../../../../../../doc/src/images/up.png" alt=
"Up"></a><a accesskey=
"h" href=
"../../index.html"><img src=
"../../../../../../doc/src/images/home.png" alt=
"Home"></a><a accesskey=
"n" href=
"float_performance.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>
26 <div class=
"titlepage"><div><div><h3 class=
"title">
27 <a name=
"boost_multiprecision.perf.int_real_world"></a><a class=
"link" href=
"int_real_world.html" title=
"Integer Real World Tests">Integer Real
29 </h3></div></div></div>
31 The first set of
<a href=
"../../../../performance/voronoi_performance.cpp" target=
"_top">tests
</a>
32 measure the times taken to execute the multiprecision part of the Voronoi-diagram
33 builder from Boost.Polygon. The tests mainly create a large number of temporaries
34 "just in case" multiprecision arithmetic is required, for comparison,
35 also included in the tests is Boost.Polygon's own partial-multiprecision
36 integer type which was custom written for this specific task:
38 <div class=
"informaltable"><table class=
"table">
51 Relative Performance (Actual time in parenthesis)
59 polygon::detail::extended_int
179 Note how for this use case, any dynamic allocation is a performance killer.
182 The next
<a href=
"../../../../performance/miller_rabin_performance.cpp" target=
"_top">tests
</a>
183 measure the time taken to generate
1000 128-bit random numbers and test for
184 primality using the Miller Rabin test. This is primarily a test of modular-exponentiation
185 since that is the rate limiting step:
187 <div class=
"informaltable"><table class=
"table">
200 Relative Performance (Actual time in parenthesis)
220 cpp_int (no Expression templates)
232 cpp_int (
128-bit cache)
244 cpp_int (
256-bit cache)
256 cpp_int (
512-bit cache)
268 cpp_int (
1024-bit cache)
316 mpz_int (no Expression templates)
340 tom_int (no Expression templates)
352 It's interesting to note that expression templates have little effect here
353 - perhaps because the actual expressions involved are relatively trivial
354 in this case - so the time taken for multiplication and division tends to
355 dominate. Also note how increasing the internal cache size used by
<code class=
"computeroutput"><span class=
"identifier">cpp_int
</span></code> is quite effective in this case
356 in cutting out memory allocations altogether - cutting about a third off
357 the total runtime. Finally the much quicker times from GMP and tommath are
358 down to their much better modular-exponentiation algorithms (GMP's is about
359 5x faster). That's an issue which needs to be addressed in a future release
360 for
<a class=
"link" href=
"../tut/ints/cpp_int.html" title=
"cpp_int">cpp_int
</a>.
363 Test code was compiled with Microsoft Visual Studio
2010 with all optimisations
364 turned on (/Ox), and used MPIR-
2.3.0 and
<a href=
"http://www.mpfr.org" target=
"_top">MPFR
</a>-
3.0.0.
365 The tests were run on
32-bit Windows Vista machine.
368 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
369 <td align=
"left"></td>
370 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2002-
2013 John Maddock and Christopher Kormanyos
<p>
371 Distributed under the Boost Software License, Version
1.0. (See accompanying
372 file LICENSE_1_0.txt or copy at
<a href=
"http://www.boost.org/LICENSE_1_0.txt" target=
"_top">http://www.boost.org/LICENSE_1_0.txt
</a>)
377 <div class=
"spirit-nav">
378 <a accesskey=
"p" href=
"realworld.html"><img src=
"../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../perf.html"><img src=
"../../../../../../doc/src/images/up.png" alt=
"Up"></a><a accesskey=
"h" href=
"../../index.html"><img src=
"../../../../../../doc/src/images/home.png" alt=
"Home"></a><a accesskey=
"n" href=
"float_performance.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>