Measure execution efficiency for compairing two solutions?

  append, c++, move, string

I want to measure the efficiency for two solutions for the same problem.

I don’t need to include any environmental "noise" into the calculation, just I want to know which of these below solutions would perform better in a perfect world, ie.: which needs more steps to execute?

string a;
int b;
string c;

//SOLUTION A
c = a;
c = std::move(c) + ',' + std:to_string(b);

//SOLUTION B
c = a;
c.append(",").append(std::to_string(b));

I don’t really have any experience in measuring execution times in this small scale, so I might have lost in the jungle, sorry if this is the case here.

Source: Windows Questions C++

LEAVE A COMMENT