Added a benchmark tool

This commit is contained in:
2020-07-08 20:38:37 -04:00
parent a7d960c3b1
commit 766af92f1a
68 changed files with 546 additions and 134 deletions

View File

@@ -34,6 +34,10 @@
int Problem21::LIMIT = 10000; //The top number that will be evaluated
Problem21::Problem21() : Problem("Evaluate the sum of all the amicable numbers under 10000"){
reserveVectors();
}
void Problem21::reserveVectors(){
divisorSum.reserve(LIMIT); //Reserving it now makes it faster later
divisorSum.resize(LIMIT); //Make sure there are enough spaces
}
@@ -113,3 +117,10 @@ uint64_t Problem21::getSum() const{
}
return mee::getSum(amicable);
}
void Problem21::reset(){
Problem::reset();
divisorSum.clear();
amicable.clear();
reserveVectors();
}