forked from Mirrorlandia_minetest/minetest
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:
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user