Monday, 2 September 2013

Benchmarking Two Functions

Benchmarking Two Functions

I am trying to check the time spent in two functions to compare them.
The functions take two backiterators as inputs.
these two are called inside one function.
void b_mark()
{
timer1.start();
function1(std::back_inserter(itr1));
timer1.stop();
timer2.start();
function2(std::back_inserter(itr2));
timer2.stop();
}
It turns out that the function I call first takes more time and does not
matter if it is function1 or function2.
What can be the general reason for this?
The timer is a wrapper to the std::clock().

No comments:

Post a Comment