mirror of https://github.com/google/benchmark.git
Cleanup and optimize Range generation.
This commit is contained in:
parent
db1af86d16
commit
2e0796e148
|
@ -547,7 +547,7 @@ void BenchmarkImp::Args(const std::vector<int>& args)
|
|||
|
||||
void BenchmarkImp::Ranges(const std::vector<std::pair<int, int>>& ranges) {
|
||||
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++) {
|
||||
AddRange(&arglists[i], ranges[i].first, ranges[i].second, range_multiplier_);
|
||||
total *= arglists[i].size();
|
||||
|
@ -555,14 +555,15 @@ void BenchmarkImp::Ranges(const std::vector<std::pair<int, int>>& ranges) {
|
|||
|
||||
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;
|
||||
tmp.reserve(arglists.size());
|
||||
|
||||
for (std::size_t j = 0; j < arglists.size(); 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++) {
|
||||
if (ctr[j] + 1 < arglists[j].size()) {
|
||||
|
|
Loading…
Reference in New Issue