Reduce bench constants for debug modes

This commit is contained in:
Ion Gaztañaga
2016-02-23 13:28:17 +01:00
parent b436c91590
commit 16ab9955f2
7 changed files with 27 additions and 32 deletions

View File

@@ -265,14 +265,14 @@ int main(int argc, const char *argv[])
#define SINGLE_TEST
#ifndef SINGLE_TEST
#ifdef NDEBUG
std::size_t numrep [] = { 3000, 30000, 300000, 3000000, 6000000, 15000000, 30000000 };
std::size_t numrep [] = { 300, 3000, 30000, 300000, 600000, 1500000, 3000000 };
#else
std::size_t numrep [] = { 20, 200, 2000, 20000, 40000, 100000, 200000 };
#endif
std::size_t numele [] = { 10000, 1000, 100, 10, 5, 2, 1 };
#else
#ifdef NDEBUG
std::size_t numrep [] = { 1500000 };
std::size_t numrep [] = { 150000 };
#else
std::size_t numrep [] = { 10000 };
#endif

View File

@@ -148,16 +148,16 @@ int allocation_loop()
#define SINGLE_TEST
#ifndef SINGLE_TEST
#ifdef NDEBUG
unsigned int numrep [] = { /*10000, */100000, 1000000, 10000000 };
#else
unsigned int numrep [] = { /*10000, */10000, 100000, 1000000 };
#else
unsigned int numrep [] = { /*10000, */1000, 10000, 100000 };
#endif
unsigned int numele [] = { /*10000, */1000, 100, 10 };
#else
#ifdef NDEBUG
unsigned int numrep [] = { 500000 };
#else
unsigned int numrep [] = { 50000 };
#else
unsigned int numrep [] = { 5000 };
#endif
unsigned int numele [] = { 100 };
#endif

View File

@@ -173,14 +173,14 @@ int main(int argc, const char *argv[])
#define SINGLE_TEST
#ifndef SINGLE_TEST
#ifdef NDEBUG
unsigned int numit [] = { 20000, 200000, 2000000, 20000000 };
unsigned int numit [] = { 2000, 20000, 200000, 2000000 };
#else
unsigned int numit [] = { 100, 1000, 10000, 100000 };
#endif
unsigned int numele [] = { 10000, 1000, 100, 10 };
#else
#ifdef NDEBUG
unsigned int numit [] = { 20000 };
unsigned int numit [] = { 2000 };
#else
unsigned int numit [] = { 100 };
#endif

View File

@@ -238,14 +238,14 @@ int main(int argc, const char *argv[])
#define SINGLE_TEST
#ifndef SINGLE_TEST
#ifdef NDEBUG
unsigned int numit [] = { 10000, 100000, 1000000, 10000000 };
unsigned int numit [] = { 1000, 10000, 100000, 1000000 };
#else
unsigned int numit [] = { 100, 1000, 10000, 100000 };
#endif
unsigned int numele [] = { 10000, 1000, 100, 10 };
#else
#ifdef NDEBUG
std::size_t numit [] = { 10000 };
std::size_t numit [] = { 1000 };
#else
std::size_t numit [] = { 100 };
#endif

View File

@@ -221,14 +221,14 @@ int main(int argc, const char *argv[])
#define SINGLE_TEST
#ifndef SINGLE_TEST
#ifdef NDEBUG
unsigned int numit [] = { 400, 4000, 40000, 400000 };
unsigned int numit [] = { 40, 400, 4000, 40000 };
#else
unsigned int numit [] = { 4, 40, 400, 4000 };
#endif
unsigned int numele [] = { 10000, 1000, 100, 10 };
#else
#ifdef NDEBUG
unsigned int numit [] = { 400 };
unsigned int numit [] = { 40 };
#else
unsigned int numit [] = { 4 };
#endif

View File

@@ -24,16 +24,12 @@ using boost::timer::cpu_timer;
using boost::timer::cpu_times;
using boost::timer::nanosecond_type;
#ifdef NDEBUG
static const std::size_t NElements = 1000;
#else
static const std::size_t NElements = 100;
#endif
#ifdef NDEBUG
static const std::size_t NIter = 500;
static const std::size_t NIter = 250;
#else
static const std::size_t NIter = 50;
static const std::size_t NIter = 25;
#endif
void compare_times(cpu_times time_numerator, cpu_times time_denominator){

View File

@@ -27,10 +27,12 @@ using boost::timer::cpu_timer;
using boost::timer::cpu_times;
using boost::timer::nanosecond_type;
static const std::size_t N = 500;
#ifdef NDEBUG
static const std::size_t N = 300;
static const std::size_t Iter = 50;
#else
static const std::size_t N = 100;
static const std::size_t Iter = 5;
#endif
//#define BENCH_SIMPLE_CONSTRUCTION
@@ -79,8 +81,7 @@ cpu_times time_it()
sortTime.stop();rotateTime.stop();destructionTime.stop();
cpu_timer totalTime, constructTime;
std::srand (0);
for(std::size_t i = 0; i< N; ++i){
for(std::size_t i = 0; i< Iter; ++i){
constructTime.resume();
{
T &v = generate<T>();
@@ -97,26 +98,24 @@ cpu_times time_it()
destructionTime.stop();
}
totalTime.stop();
std::cout << " construction took " << boost::timer::format(constructTime.elapsed());
std::cout << " sort took " << boost::timer::format(sortTime.elapsed());
std::cout << " rotate took " << boost::timer::format(rotateTime.elapsed());
std::cout << " destruction took " << boost::timer::format(destructionTime.elapsed());
std::cout << " Total time = " << boost::timer::format(totalTime.elapsed()) << std::endl;
std::cout << " construction took " << boost::timer::format(constructTime.elapsed(), 6, "%ws wall, %ts CPU (%p%)\n");
std::cout << " sort took " << boost::timer::format(sortTime.elapsed(), 6, "%ws wall, %ts CPU (%p%)\n");
std::cout << " rotate took " << boost::timer::format(rotateTime.elapsed(), 6, "%ws wall, %ts CPU (%p%)\n");
std::cout << " destruction took " << boost::timer::format(destructionTime.elapsed(), 6, "%ws wall, %ts CPU (%p%)\n");
std::cout << " Total time = " << boost::timer::format(totalTime.elapsed(), 6, "%ws wall, %ts CPU (%p%)\n") << std::endl;
return totalTime.elapsed();
}
void compare_times(cpu_times time_numerator, cpu_times time_denominator){
std::cout
<< "\n wall = " << ((double)time_numerator.wall/(double)time_denominator.wall)
<< "\n user = " << ((double)time_numerator.user/(double)time_denominator.user)
<< "\n system = " << ((double)time_numerator.system/(double)time_denominator.system)
<< "\n (user+system) = " << ((double)(time_numerator.system+time_numerator.user)/(double)(time_denominator.system+time_denominator.user)) << "\n\n";
<< "\n (user+sys) = " << ((double)(time_numerator.system+time_numerator.user)/(double)(time_denominator.system+time_denominator.user)) << "\n\n";
}
int main()
{
try {
std::cout << "N = " << N << "\n\n";
std::cout << "N = " << N << " Iter = " << Iter << "\n\n";
std::cout << "varray benchmark:" << std::endl;
cpu_times time_varray = time_it<boost::container::varray<boost::container::varray<basic_type_t,N>,N > >();