Optimize subgames search a little bit (#8096)

Reserve space for the list of games in findWorldSubgame. The
performance gain is pretty much negligible but this change
also gets rid of a performance warning by CLANG TIDY.
This commit is contained in:
Jozef Behran 2019-01-18 04:47:50 -05:00 committed by Loïc Blot
parent 3fce27ece5
commit 6e37fdc21d

@ -195,6 +195,7 @@ std::vector<SubgameSpec> getAvailableGames()
{ {
std::vector<SubgameSpec> specs; std::vector<SubgameSpec> specs;
std::set<std::string> gameids = getAvailableGameIds(); std::set<std::string> gameids = getAvailableGameIds();
specs.reserve(gameids.size());
for (const auto &gameid : gameids) for (const auto &gameid : gameids)
specs.push_back(findSubgame(gameid)); specs.push_back(findSubgame(gameid));
return specs; return specs;