Optimize subgames search a little bit (#8096)
authorJozef Behran <jozuejozef@gmail.com>
Fri, 18 Jan 2019 09:47:50 +0000 (04:47 -0500)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Fri, 18 Jan 2019 09:47:50 +0000 (10:47 +0100)
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.

src/content/subgames.cpp

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