Commit 2e0796e1 by Eric Fiselier

Cleanup and optimize Range generation.

parent db1af86d
...@@ -547,7 +547,7 @@ void BenchmarkImp::Args(const std::vector<int>& args) ...@@ -547,7 +547,7 @@ void BenchmarkImp::Args(const std::vector<int>& args)
void BenchmarkImp::Ranges(const std::vector<std::pair<int, int>>& ranges) { void BenchmarkImp::Ranges(const std::vector<std::pair<int, int>>& ranges) {
std::vector<std::vector<int>> arglists(ranges.size()); std::vector<std::vector<int>> arglists(ranges.size());
int total = 1; std::size_t total = 1;
for (std::size_t i = 0; i < ranges.size(); i++) { for (std::size_t i = 0; i < ranges.size(); i++) {
AddRange(&arglists[i], ranges[i].first, ranges[i].second, range_multiplier_); AddRange(&arglists[i], ranges[i].first, ranges[i].second, range_multiplier_);
total *= arglists[i].size(); total *= arglists[i].size();
...@@ -555,14 +555,15 @@ void BenchmarkImp::Ranges(const std::vector<std::pair<int, int>>& ranges) { ...@@ -555,14 +555,15 @@ void BenchmarkImp::Ranges(const std::vector<std::pair<int, int>>& ranges) {
std::vector<std::size_t> ctr(arglists.size(), 0); std::vector<std::size_t> ctr(arglists.size(), 0);
for (int i = 0; i < total; i++) { for (std::size_t i = 0; i < total; i++) {
std::vector<int> tmp; std::vector<int> tmp;
tmp.reserve(arglists.size());
for (std::size_t j = 0; j < arglists.size(); j++) { for (std::size_t j = 0; j < arglists.size(); j++) {
tmp.push_back(arglists[j][ctr[j]]); tmp.push_back(arglists[j][ctr[j]]);
} }
args_.push_back(tmp); args_.push_back(std::move(tmp));
for (std::size_t j = 0; j < arglists.size(); j++) { for (std::size_t j = 0; j < arglists.size(); j++) {
if (ctr[j] + 1 < arglists[j].size()) { if (ctr[j] + 1 < arglists[j].size()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment