Files
multiprecision/doc/performance_integer_real_world.qbk
ivanpanch 55bf069621 Fix mistakes (#729)
* Update Jamfile.v2

* Update introduction.qbk

* Update tutorial.qbk

* Update tutorial_cpp_int.qbk

* Update tutorial_gmp_int.qbk

* Update tutorial_tommath.qbk

* Update integer_examples.cpp

* Update tutorial_cpp_bin_float.qbk

* Update tutorial_cpp_dec_float.qbk

* Update tutorial_gmp_float.qbk

* Update tutorial_mpfr_float.qbk

* Update tutorial_float128.qbk

* Update tutorial_float_builtin_ctor.qbk

* Update big_seventh.cpp

* Update tutorial_float_eg.qbk

* Update floating_point_examples.cpp

* Update mpfr_precision.cpp

* Update gauss_laguerre_quadrature.cpp

* Update tutorial_interval_mpfi.qbk

* Update tutorial_cpp_complex.qbk

* Update tutorial_mpc_complex.qbk

* Update tutorial_float128_complex.qbk

* Update tutorial_complex_adaptor.qbk

* Update tutorial_rational.qbk

* Update tutorial_tommath_rational.qbk

* Update tutorial_logged_adaptor.qbk

* Update tutorial_debug_adaptor.qbk

* Update tutorial_visualizers.qbk

* Update tutorial_fwd.qbk

* Update tutorial_conversions.qbk

* Update tutorial_random.qbk

* Update random_snips.cpp

* Update tutorial_constexpr.qbk

* Update tutorial_import_export.qbk

* Update cpp_int_import_export.cpp

* Update tutorial_mixed_precision.qbk

* Update tutorial_variable_precision.qbk

* Update scoped_precision_example.cpp

* Update tutorial_numeric_limits.qbk

* Update tutorial_numeric_limits.qbk

* Update numeric_limits_snips.cpp

* Update numeric_limits_snips.cpp

* Update tutorial_numeric_limits.qbk

* Update numeric_limits_snips.cpp

* Update numeric_limits_snips.cpp

* Update tutorial_io.qbk

* Update reference_number.qbk

* Update reference_cpp_bin_float.qbk

* Update reference_cpp_double_fp_backend.qbk

* Update reference_internal_support.qbk

* Update reference_backend_requirements.qbk

* Update performance.qbk

* Update performance_overhead.qbk

* Update performance_real_world.qbk

* Update performance_integer_real_world.qbk

* Update performance_rational_real_world.qbk

* Update reference_number.qbk

* Update tutorial_numeric_limits.qbk

* Update reference_backend_requirements.qbk
2025-08-18 13:14:39 +02:00

71 lines
2.8 KiB
Plaintext

[/
Copyright 2011 - 2020 John Maddock.
Copyright 2013 - 2019 Paul A. Bristow.
Copyright 2013 Christopher Kormanyos.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
]
[section:int_real_world Integer Real World Tests]
The first set of [@../../performance/voronoi_performance.cpp tests] measure the times taken to
execute the multiprecision part of the Voronoi-diagram builder from Boost.Polygon. The tests
mainly create a large number of temporaries "just in case" multiprecision arithmetic is required,
for comparison, also included in the tests is Boost.Polygon's own partial-multiprecision integer
type which was custom written for this specific task:
[table
[[Integer Type][Relative Performance (Actual time in parenthesis)]]
[[checked_int1024_t][1.53714 (0.0415328s)]]
[[checked_int256_t][1.20715 (0.0326167s)]]
[[checked_int512_t][1.2587 (0.0340095s)]]
[[cpp_int][1.80575 (0.0487904s)]]
[[extended_int][1.35652 (0.0366527s)]]
[[int1024_t][1.36237 (0.0368107s)]]
[[int256_t][1 (0.0270196s)]]
[[int512_t][1.0779 (0.0291243s)]]
[[mpz_int][3.83495 (0.103619s)]]
[[tom_int][41.6378 (1.12504s)]]
]
Note how for this use case, any dynamic allocation is a performance killer.
The next [@../../performance/miller_rabin_performance.cpp tests] measure the time taken to generate 1000 128-bit
random numbers and test for primality using the Miller Rabin test. This is primarily a test of modular-exponentiation
since that is the rate limiting step:
[table
[[Integer Type][Relative Performance (Actual time in parenthesis)]]
[[checked_uint1024_t][9.52301 (0.0422246s)]]
[[cpp_int][11.2194 (0.0497465s)]]
[[cpp_int (1024-bit cache)][10.7941 (0.0478607s)]]
[[cpp_int (128-bit cache)][11.0637 (0.0490558s)]]
[[cpp_int (256-bit cache)][11.5069 (0.0510209s)]]
[[cpp_int (512-bit cache)][10.3303 (0.0458041s)]]
[[cpp_int (no Expression templates)][16.1792 (0.0717379s)]]
[[mpz_int][1.05106 (0.00466034s)]]
[[mpz_int (no Expression templates)][1 (0.00443395s)]]
[[tom_int][5.10595 (0.0226395s)]]
[[tom_int (no Expression templates)][61.9684 (0.274765s)]]
[[uint1024_t][9.32113 (0.0413295s)]]
]
It's interesting to note that expression templates have little effect here - perhaps because the actual expressions involved
are relatively trivial in this case - so the time taken for multiplication and division tends to dominate. The much
quicker times from GMP and tommath are down to their
much better modular-exponentiation algorithms (GMP's is about 5x faster). That's an issue which needs to be addressed
in a future release for __cpp_int.
[table:platform Platform Details
[[][Version]]
[[Compiler][GNU C++ version 10.3.0]]
[[GMP][6.2.0]]
[[MPFR][262146]]
[[Boost][107800]]
[[Run date][Sep 30 2021]]
]
[endsect]