aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2015-03-05 10:43:08 +0100
committerLoic Blot <loic.blot@unix-experience.fr>2015-03-05 10:44:48 +0100
commit365e4ae0faee79ff7b62396f27667e8315ba94d4 (patch)
tree80b4ef80a339433562e23cd47980f4aae87bf938 /src/script/lua_api
parentb214cde5b4a833e1826ec6850b95bf1938c8b0a0 (diff)
downloadminetest-365e4ae0faee79ff7b62396f27667e8315ba94d4.tar.gz
minetest-365e4ae0faee79ff7b62396f27667e8315ba94d4.tar.bz2
minetest-365e4ae0faee79ff7b62396f27667e8315ba94d4.zip
Performance improvement: Use std::list instead of std::vector for request_media, Server::getModNames, Environment::m_simple_objects.
* Also remove unused Server::m_modspaths
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_server.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/script/lua_api/l_server.cpp b/src/script/lua_api/l_server.cpp
index 8d7f6512e..16331a933 100644
--- a/src/script/lua_api/l_server.cpp
+++ b/src/script/lua_api/l_server.cpp
@@ -367,13 +367,14 @@ int ModApiServer::l_get_modnames(lua_State *L)
NO_MAP_LOCK_REQUIRED;
// Get a list of mods
- std::list<std::string> mods_unsorted, mods_sorted;
+ std::vector<std::string> mods_unsorted;
+ std::list<std::string> mods_sorted;
getServer(L)->getModNames(mods_unsorted);
// Take unsorted items from mods_unsorted and sort them into
// mods_sorted; not great performance but the number of mods on a
// server will likely be small.
- for(std::list<std::string>::iterator i = mods_unsorted.begin();
+ for(std::vector<std::string>::iterator i = mods_unsorted.begin();
i != mods_unsorted.end(); ++i) {
bool added = false;
for(std::list<std::string>::iterator x = mods_sorted.begin();