summaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
authorJozef Behran <jozuejozef@gmail.com>2019-01-18 04:47:50 -0500
committerLoïc Blot <nerzhul@users.noreply.github.com>2019-01-18 10:47:50 +0100
commit6e37fdc21d3f78c006d748103b3f9e8feeb0d49f (patch)
treefe6677ce76a77c0dcbd17e35c7e279162b1b68d5 /src/content
parent3fce27ece5629a805a5d6c508f130170c6ccafab (diff)
downloadminetest-6e37fdc21d3f78c006d748103b3f9e8feeb0d49f.tar.gz
minetest-6e37fdc21d3f78c006d748103b3f9e8feeb0d49f.tar.bz2
minetest-6e37fdc21d3f78c006d748103b3f9e8feeb0d49f.zip
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.
Diffstat (limited to 'src/content')
-rw-r--r--src/content/subgames.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/content/subgames.cpp b/src/content/subgames.cpp
index 4bdd84f41..4b0e37f7c 100644
--- a/src/content/subgames.cpp
+++ b/src/content/subgames.cpp
@@ -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;