projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3fce27e
)
Optimize subgames search a little bit (#8096)
author
Jozef Behran
<jozuejozef@gmail.com>
Fri, 18 Jan 2019 09:47:50 +0000
(
04:47
-0500)
committer
Loï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
patch
|
blob
|
history
diff --git
a/src/content/subgames.cpp
b/src/content/subgames.cpp
index 4bdd84f416b854375ade9e5629b47b51a2f90c80..4b0e37f7cdcae31fed90a1c457339cde5a2f1d17 100644
(file)
--- 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;