Optimize container insertions using emplace_back instead of push_back

This commit is contained in:
Pugemon
2024-06-07 04:43:27 +03:00
parent f25a425cb9
commit e98fb9a1a7
9 changed files with 13 additions and 13 deletions
+2 -2
View File
@@ -81,7 +81,7 @@ static int l_reconfig_packs(lua_State* L) {
int addLen = lua_objlen(L, 1);
for (int i = 0; i < addLen; i++) {
lua_rawgeti(L, 1, i+1);
addPacks.push_back(lua_tostring(L, -1));
addPacks.emplace_back(lua_tostring(L, -1));
lua_pop(L, 1);
}
@@ -92,7 +92,7 @@ static int l_reconfig_packs(lua_State* L) {
int remLen = lua_objlen(L, 2);
for (int i = 0; i < remLen; i++) {
lua_rawgeti(L, 2, i+1);
remPacks.push_back(lua_tostring(L, -1));
remPacks.emplace_back(lua_tostring(L, -1));
lua_pop(L, 1);
}
auto controller = scripting::engine->getController();