|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77741 - sandbox/big_number/libs/multiprecision/performance
From: john_at_[hidden]
Date: 2012-04-03 12:20:13
Author: johnmaddock
Date: 2012-04-03 12:20:11 EDT (Tue, 03 Apr 2012)
New Revision: 77741
URL: http://svn.boost.org/trac/boost/changeset/77741
Log:
Tidy up code, and add multi-threaded test case.
Text files modified:
sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp | 374 ++++++++++++++-------------------------
1 files changed, 134 insertions(+), 240 deletions(-)
Modified: sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp (original)
+++ sandbox/big_number/libs/multiprecision/performance/sf_performance.cpp 2012-04-03 12:20:11 EDT (Tue, 03 Apr 2012)
@@ -3,15 +3,15 @@
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
-#define BOOST_CHRONO_HEADER_ONLY
#define BOOST_MATH_MAX_ROOT_ITERATION_POLICY 500
-#if !defined(TEST_MPFR) && !defined(TEST_MP_REAL) && !defined(TEST_MPF)
+#if !defined(TEST_MPFR) && !defined(TEST_MPREAL) && !defined(TEST_MPF) && !defined(TEST_MPREAL) \
+ && !defined(TEST_CPP_DEC_FLOAT) && !defined(TEST_MPFR_CLASS)
# define TEST_MPFR
# define TEST_MPF
-# define TEST_MPF
# define TEST_CPP_DEC_FLOAT
# define TEST_MPFR_CLASS
+# define TEST_MPREAL
#endif
#ifdef TEST_MPFR_CLASS
@@ -20,7 +20,7 @@
#ifdef TEST_MPFR
#include <boost/multiprecision/mpfr.hpp>
#endif
-#ifdef TEST_MP_REAL
+#ifdef TEST_MPREAL
#include <boost/math/bindings/mpreal.hpp>
#endif
#ifdef TEST_MPF
@@ -35,6 +35,7 @@
#include <libs/math/test/table_type.hpp>
#include <boost/chrono.hpp>
#include <boost/array.hpp>
+#include <boost/thread.hpp>
template <class Real>
Real test_bessel();
@@ -63,48 +64,54 @@
template <class Real>
Real test_bessel()
{
+ try{
# define T double
# define SC_(x) x
# include "libs/math/test/bessel_i_int_data.ipp"
# include "libs/math/test/bessel_i_data.ipp"
- Real r;
+ Real r;
- for(unsigned i = 0; i < bessel_i_int_data.size(); ++i)
- {
- r += boost::math::cyl_bessel_i(Real(bessel_i_int_data[i][0]), Real(bessel_i_int_data[i][1]));
- }
- for(unsigned i = 0; i < bessel_i_data.size(); ++i)
- {
- r += boost::math::cyl_bessel_i(Real(bessel_i_data[i][0]), Real(bessel_i_data[i][1]));
- }
+ for(unsigned i = 0; i < bessel_i_int_data.size(); ++i)
+ {
+ r += boost::math::cyl_bessel_i(Real(bessel_i_int_data[i][0]), Real(bessel_i_int_data[i][1]));
+ }
+ for(unsigned i = 0; i < bessel_i_data.size(); ++i)
+ {
+ r += boost::math::cyl_bessel_i(Real(bessel_i_data[i][0]), Real(bessel_i_data[i][1]));
+ }
#include "libs/math/test/bessel_j_int_data.ipp"
- for(unsigned i = 0; i < bessel_j_int_data.size(); ++i)
- {
- r += boost::math::cyl_bessel_j(Real(bessel_j_int_data[i][0]), Real(bessel_j_int_data[i][1]));
- }
+ for(unsigned i = 0; i < bessel_j_int_data.size(); ++i)
+ {
+ r += boost::math::cyl_bessel_j(Real(bessel_j_int_data[i][0]), Real(bessel_j_int_data[i][1]));
+ }
#include "libs/math/test/bessel_j_data.ipp"
- for(unsigned i = 0; i < bessel_j_data.size(); ++i)
- {
- r += boost::math::cyl_bessel_j(Real(bessel_j_data[i][0]), Real(bessel_j_data[i][1]));
- }
+ for(unsigned i = 0; i < bessel_j_data.size(); ++i)
+ {
+ r += boost::math::cyl_bessel_j(Real(bessel_j_data[i][0]), Real(bessel_j_data[i][1]));
+ }
#include "libs/math/test/bessel_j_large_data.ipp"
- for(unsigned i = 0; i < bessel_j_large_data.size(); ++i)
- {
- r += boost::math::cyl_bessel_j(Real(bessel_j_large_data[i][0]), Real(bessel_j_large_data[i][1]));
- }
+ for(unsigned i = 0; i < bessel_j_large_data.size(); ++i)
+ {
+ r += boost::math::cyl_bessel_j(Real(bessel_j_large_data[i][0]), Real(bessel_j_large_data[i][1]));
+ }
#include "libs/math/test/sph_bessel_data.ipp"
- for(unsigned i = 0; i < sph_bessel_data.size(); ++i)
+ for(unsigned i = 0; i < sph_bessel_data.size(); ++i)
+ {
+ r += boost::math::sph_bessel(static_cast<unsigned>(sph_bessel_data[i][0]), Real(sph_bessel_data[i][1]));
+ }
+
+ return r;
+ }
+ catch(const std::exception& e)
{
- r += boost::math::sph_bessel(static_cast<unsigned>(sph_bessel_data[i][0]), Real(sph_bessel_data[i][1]));
+ std::cout << e.what() << std::endl;
}
-
-
- return r;
+ return 0;
}
template <class Real>
@@ -161,54 +168,89 @@
return (*realloc_func_ptr)(p, old, n);
}
+template <class Real>
+void basic_allocation_test(const char* name, Real x)
+{
+ static const unsigned a[] = { 2, 3, 4, 5, 6, 7, 8 };
+ allocation_count = 0;
+ Real result = (((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0];
+ std::cout << "Allocation count for type " << name << " = " << allocation_count << std::endl;
+}
+
+template <class Real>
+void poly_allocation_test(const char* name, Real x)
+{
+ static const unsigned a[] = { 2, 3, 4, 5, 6, 7, 8 };
+ allocation_count = 0;
+ Real result = boost::math::tools::evaluate_polynomial(a, x);
+ std::cout << "Allocation count for type " << name << " = " << allocation_count << std::endl;
+}
+
+template <class Real>
+void time_proc(const char* name, Real (*proc)(), unsigned threads = 1)
+{
+ try{
+ static Real total = 0;
+ allocation_count = 0;
+ boost::chrono::duration<double> time;
+ stopwatch<boost::chrono::high_resolution_clock> c;
+ total += proc();
+ time = c.elapsed();
+ std::cout << "Time for " << name << " = " << time << std::endl;
+ std::cout << "Total allocations for " << name << " = " << allocation_count << std::endl;
+
+ for(unsigned thread_count = 1; thread_count < threads; ++thread_count)
+ {
+ c.reset();
+ boost::thread_group g;
+ for(unsigned i = 0; i <= thread_count; ++i)
+ g.create_thread(proc);
+ g.join_all();
+ time = c.elapsed();
+ std::cout << "Time for " << name << " (" << (thread_count + 1) << " threads) = " << time << std::endl;
+ std::cout << "Total allocations for " << name << " = " << allocation_count << std::endl;
+ }
+ }
+ catch(const std::exception& e)
+ {
+ std::cout << e.what() << std::endl;
+ }
+}
+
int main()
{
+ using namespace boost::multiprecision;
+#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS) || defined(TEST_MPREAL)
mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr);
mp_set_memory_functions(&alloc_func, &realloc_func, &free_func);
+#endif
- static const unsigned a[] = {
- 2, 3, 4, 5, 6, 7, 8 };
+ std::cout << "Allocation Counts for Horner Evaluation:\n";
#ifdef TEST_MPFR
- boost::multiprecision::mpfr_float_50 result, x(2);
- allocation_count = 0;
- result = (((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0];
- std::cout << allocation_count << std::endl;
+ basic_allocation_test("mpfr_float_50", mpfr_float_50(2));
#endif
#ifdef TEST_MPFR_CLASS
- mpfr_class r, x2(2);
- allocation_count = 0;
- r = (((((a[6] * x2 + a[5]) * x2 + a[4]) * x2 + a[3]) * x2 + a[2]) * x2 + a[1]) * x2 + a[0];
- std::cout << allocation_count << std::endl;
+ basic_allocation_test("mpfr_class", mpfr_class(2));
#endif
#ifdef TEST_MPREAL
- mpfr::mpreal r2, x3(2);
- allocation_count = 0;
- r2 = (((((a[6] * x3 + a[5]) * x3 + a[4]) * x3 + a[3]) * x3 + a[2]) * x3 + a[1]) * x3 + a[0];
- std::cout << allocation_count << std::endl;
+ basic_allocation_test("mpfr::mpreal", mpfr::mpreal(2));
#endif
- allocation_count = 0;
+ std::cout << "Allocation Counts for boost::math::tools::evaluate_polynomial:\n";
#ifdef TEST_MPFR
- result = boost::math::tools::evaluate_polynomial(a, x);
- std::cout << allocation_count << std::endl;
- allocation_count = 0;
+ poly_allocation_test("mpfr_float_50", mpfr_float_50(2));
#endif
#ifdef TEST_MPFR_CLASS
- r = boost::math::tools::evaluate_polynomial(a, x2);
- std::cout << allocation_count << std::endl;
- allocation_count = 0;
+ poly_allocation_test("mpfr_class", mpfr_class(2));
#endif
#ifdef TEST_MPREAL
- r2 = boost::math::tools::evaluate_polynomial(a, x3);
- std::cout << allocation_count << std::endl;
+ poly_allocation_test("mpfr::mpreal", mpfr::mpreal(2));
#endif
- boost::chrono::duration<double> time;
- stopwatch<boost::chrono::high_resolution_clock> c;
//
// 50 digits first:
//
- std::cout << "Testing Bessel Functions....." << std::endl;
+ std::cout << "Testing Bessel Functions at 50 digits....." << std::endl;
#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS)
mpfr_set_default_prec(50 * 1000L / 301L);
#endif
@@ -216,48 +258,25 @@
mpfr::mpreal::set_default_prec(50 * 1000L / 301L);
#endif
#ifdef TEST_MPFR
- c.reset();
- test_bessel<boost::multiprecision::mpfr_float_50>();
- time = c.elapsed();
- std::cout << "Time for mpfr_float_50 = " << time << std::endl;
- std::cout << "Total allocations for mpfr_float_50 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_float_50", test_bessel<boost::multiprecision::mpfr_float_50>, mpfr_buildopt_tls_p() ? 3 : 1);
#endif
#ifdef TEST_MPF
- c.reset();
- test_bessel<boost::multiprecision::mpf_float_50>();
- time = c.elapsed();
- std::cout << "Time for mpf_float_50 = " << time << std::endl;
- std::cout << "Total allocations for mpf_float_50 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpf_float_50", test_bessel<mpf_float_50>, 3);
+ time_proc("mpf_float_50 (no expression templates", test_bessel<mp_number<gmp_float<50>, false> >, 3);
#endif
#ifdef TEST_CPP_DEC_FLOAT
- c.reset();
- test_bessel<boost::multiprecision::cpp_dec_float_50>();
- time = c.elapsed();
- std::cout << "Time for cpp_dec_float_50 = " << time << std::endl;
- std::cout << "Total allocations for cpp_dec_float_50 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("cpp_dec_float_50", test_bessel<cpp_dec_float_50>, 3);
#endif
#ifdef TEST_MPFR_CLASS
- c.reset();
- test_bessel<mpfr_class>();
- time = c.elapsed();
- std::cout << "Time for mpfr_class (50 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpfr_class (50 digits) = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_class", test_bessel<mpfr_class>, mpfr_buildopt_tls_p() ? 3 : 1);
#endif
#ifdef TEST_MP_REAL
- c.reset();
- test_bessel<mpfr::mpreal>();
- time = c.elapsed();
- std::cout << "Time for mpreal (50 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpreal (50 digits) = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr::mpreal", test_bessel<mpfr::mpreal>, mpfr_buildopt_tls_p() ? 3 : 1);
#endif
//
// Then 100 digits:
//
+ std::cout << "Testing Bessel Functions at 100 digits....." << std::endl;
#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS)
mpfr_set_default_prec(100 * 1000L / 301L);
#endif
@@ -265,51 +284,25 @@
mpfr::mpreal::set_default_prec(100 * 1000L / 301L);
#endif
#ifdef TEST_MPFR
- c.reset();
- test_bessel<boost::multiprecision::mpfr_float_100>();
- time = c.elapsed();
- std::cout << "Time for mpfr_float_100 = " << time << std::endl;
- std::cout << "Total allocations for mpfr_float_50 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_float_100", test_bessel<mpfr_float_100>);
#endif
#ifdef TEST_MPF
- c.reset();
- test_bessel<boost::multiprecision::mpf_float_100>();
- time = c.elapsed();
- std::cout << "Time for mpf_float_100 = " << time << std::endl;
- std::cout << "Total allocations for mpf_float_100 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpf_float_100", test_bessel<mpf_float_100>);
#endif
#ifdef TEST_CPP_DEC_FLOAT
- c.reset();
- test_bessel<boost::multiprecision::cpp_dec_float_100>();
- time = c.elapsed();
- std::cout << "Time for cpp_dec_float_100 = " << time << std::endl;
- std::cout << "Total allocations for cpp_dec_float_100 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("cpp_dec_float_100", test_bessel<cpp_dec_float_100>);
#endif
#ifdef TEST_MPFR_CLASS
- c.reset();
- test_bessel<mpfr_class>();
- time = c.elapsed();
- std::cout << "Time for mpfr_class (100 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpfr_class (100 digits) = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_class", test_bessel<mpfr_class>);
#endif
#ifdef TEST_MPREAL
- c.reset();
- test_bessel<mpfr::mpreal>();
- time = c.elapsed();
- std::cout << "Time for mpreal (100 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpreal (100 digits) = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr::mpreal", test_bessel<mpfr::mpreal>);
#endif
//
// 50 digits first:
//
- c.reset();
- std::cout << "Testing Polynomial Evaluation....." << std::endl;
+ std::cout << "Testing Polynomial Evaluation at 50 digits....." << std::endl;
#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS)
mpfr_set_default_prec(50 * 1000L / 301L);
#endif
@@ -317,48 +310,24 @@
mpfr::mpreal::set_default_prec(50 * 1000L / 301L);
#endif
#ifdef TEST_MPFR
- c.reset();
- test_polynomial<boost::multiprecision::mpfr_float_50>();
- time = c.elapsed();
- std::cout << "Time for mpfr_float_50 = " << time << std::endl;
- std::cout << "Total allocations for mpfr_float_50 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_float_50", test_polynomial<mpfr_float_50>);
#endif
#ifdef TEST_MPF
- c.reset();
- test_polynomial<boost::multiprecision::mpf_float_50>();
- time = c.elapsed();
- std::cout << "Time for mpf_float_50 = " << time << std::endl;
- std::cout << "Total allocations for mpf_float_50 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpf_float_50", test_polynomial<mpf_float_50>);
#endif
#ifdef TEST_CPP_DEC_FLOAT
- c.reset();
- test_polynomial<boost::multiprecision::cpp_dec_float_50>();
- time = c.elapsed();
- std::cout << "Time for cpp_dec_float_50 = " << time << std::endl;
- std::cout << "Total allocations for cpp_dec_float_50 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("cpp_dec_float_50", test_polynomial<cpp_dec_float_50>);
#endif
#ifdef TEST_MPFR_CLASS
- c.reset();
- test_polynomial<mpfr_class>();
- time = c.elapsed();
- std::cout << "Time for mpfr_class (50 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpfr_class (50 digits) = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_class", test_polynomial<mpfr_class>);
#endif
#ifdef TEST_MPREAL
- c.reset();
- test_polynomial<mpfr::mpreal>();
- time = c.elapsed();
- std::cout << "Time for mpreal (50 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpreal (50 digits = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr::mpreal", test_polynomial<mpfr::mpreal>);
#endif
//
// Then 100 digits:
//
+ std::cout << "Testing Polynomial Evaluation at 100 digits....." << std::endl;
#ifdef TEST_MPFR_CLASS
mpfr_set_default_prec(100 * 1000L / 301L);
#endif
@@ -366,50 +335,24 @@
mpfr::mpreal::set_default_prec(100 * 1000L / 301L);
#endif
#ifdef TEST_MPFR
- c.reset();
- test_polynomial<boost::multiprecision::mpfr_float_100>();
- time = c.elapsed();
- std::cout << "Time for mpfr_float_100 = " << time << std::endl;
- std::cout << "Total allocations for mpfr_float_100 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_float_100", test_polynomial<mpfr_float_100>);
#endif
#ifdef TEST_MPF
- c.reset();
- test_polynomial<boost::multiprecision::mpf_float_100>();
- time = c.elapsed();
- std::cout << "Time for mpf_float_100 = " << time << std::endl;
- std::cout << "Total allocations for mpf_float_100 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpf_float_100", test_polynomial<mpf_float_100>);
#endif
#ifdef TEST_CPP_DEC_FLOAT
- c.reset();
- test_polynomial<boost::multiprecision::cpp_dec_float_100>();
- time = c.elapsed();
- std::cout << "Time for cpp_dec_float_100 = " << time << std::endl;
- std::cout << "Total allocations for cpp_dec_float_100 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("cpp_dec_float_100", test_polynomial<cpp_dec_float_100>);
#endif
#ifdef TEST_MPFR_CLASS
- c.reset();
- test_polynomial<mpfr_class>();
- time = c.elapsed();
- std::cout << "Time for mpfr_class (100 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpfr_class (100 digits) = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_class", test_polynomial<mpfr_class>);
#endif
#ifdef TEST_MPREAL
- c.reset();
- test_polynomial<mpfr::mpreal>();
- time = c.elapsed();
- std::cout << "Time for mpreal (100 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpreal (100 digits) = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr::mpreal", test_polynomial<mpfr::mpreal>);
#endif
//
// 50 digits first:
//
- c.reset();
- std::cout << "Testing Non-Central T....." << std::endl;
+ std::cout << "Testing Non-Central T at 50 digits....." << std::endl;
#ifdef TEST_MPFR_CLASS
mpfr_set_default_prec(50 * 1000L / 301L);
#endif
@@ -417,48 +360,24 @@
mpfr::mpreal::set_default_prec(50 * 1000L / 301L);
#endif
#ifdef TEST_MPFR
- c.reset();
- test_nct<boost::multiprecision::mpfr_float_50>();
- time = c.elapsed();
- std::cout << "Time for mpfr_float_50 = " << time << std::endl;
- std::cout << "Total allocations for mpfr_float_50 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_float_50", test_nct<mpfr_float_50>);
#endif
#ifdef TEST_MPF
- c.reset();
- test_nct<boost::multiprecision::mpf_float_50>();
- time = c.elapsed();
- std::cout << "Time for mpf_float_50 = " << time << std::endl;
- std::cout << "Total allocations for mpf_float_50 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpf_float_50", test_nct<mpf_float_50>);
#endif
#ifdef TEST_CPP_DEC_FLOAT
- c.reset();
- test_nct<boost::multiprecision::cpp_dec_float_50>();
- time = c.elapsed();
- std::cout << "Time for cpp_dec_float_50 = " << time << std::endl;
- std::cout << "Total allocations for cpp_dec_float_50 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("cpp_dec_float_50", test_nct<cpp_dec_float_50>);
#endif
#ifdef TEST_MPFR_CLASS
- c.reset();
- test_nct<mpfr_class>();
- time = c.elapsed();
- std::cout << "Time for mpfr_class (50 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpfr_class (50 digits) = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_class", test_nct<mpfr_class>);
#endif
#ifdef TEST_MP_REAL
- c.reset();
- test_nct<mpfr::mpreal>();
- time = c.elapsed();
- std::cout << "Time for mpreal (50 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpreal (50 digits) = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr::mpreal", test_nct<mpfr::mpreal>);
#endif
//
// Then 100 digits:
//
+ std::cout << "Testing Non-Central T at 100 digits....." << std::endl;
#ifdef TEST_MPFR_CLASS
mpfr_set_default_prec(100 * 1000L / 301L);
#endif
@@ -466,44 +385,19 @@
mpfr::mpreal::set_default_prec(100 * 1000L / 301L);
#endif
#ifdef TEST_MPFR
- c.reset();
- test_nct<boost::multiprecision::mpfr_float_100>();
- time = c.elapsed();
- std::cout << "Time for mpfr_float_100 = " << time << std::endl;
- std::cout << "Total allocations for mpfr_float_100 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_float_100", test_nct<mpfr_float_100>);
#endif
#ifdef TEST_MPF
- c.reset();
- test_nct<boost::multiprecision::mpf_float_100>();
- time = c.elapsed();
- std::cout << "Time for mpf_float_100 = " << time << std::endl;
- std::cout << "Total allocations for mpf_float_100 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpf_float_100", test_nct<mpf_float_100>);
#endif
#ifdef TEST_CPP_DEC_FLOAT
- c.reset();
- test_nct<boost::multiprecision::cpp_dec_float_100>();
- time = c.elapsed();
- std::cout << "Time for cpp_dec_float_100 = " << time << std::endl;
- std::cout << "Total allocations for cpp_dec_float_100 = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("cpp_dec_float_100", test_nct<cpp_dec_float_100>);
#endif
#ifdef TEST_MPFR_CLASS
- c.reset();
- test_nct<mpfr_class>();
- time = c.elapsed();
- std::cout << "Time for mpfr_class (100 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpfr_class (100 digits) = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr_class", test_nct<mpfr_class>);
#endif
#ifdef TEST_MPREAL
- c.reset();
- test_nct<mpfr::mpreal>();
- time = c.elapsed();
- std::cout << "Time for mpreal (100 digits) = " << time << std::endl;
- std::cout << "Total allocations for mpreal (100 digits) = " << allocation_count << std::endl;
- allocation_count = 0;
+ time_proc("mpfr::mpreal", test_nct<mpfr::mpreal>);
#endif
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk