1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-01 03:21:41 +00:00

enables std::move in keywordsearch.hpp (#3163)

For some reason we have commented std::move keywords in keywordsearch.hpp while they are quite beneficial. openmw_test_suite for keywordsearch.hpp takes 30% less time with these changes.
This commit is contained in:
Bo Svensson 2021-10-10 16:15:40 +00:00 committed by GitHub
parent 031871cd48
commit af759683b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ public:
{
if (keyword.empty())
return;
seed_impl (/*std::move*/ (keyword), /*std::move*/ (value), 0, mRoot);
seed_impl (std::move(keyword), std::move (value), 0, mRoot);
}
void clear ()
@ -39,7 +39,7 @@ public:
mRoot.mKeyword.clear ();
}
bool containsKeyword (string_t keyword, value_t& value)
bool containsKeyword (const string_t& keyword, value_t& value)
{
typename Entry::childen_t::iterator current;
typename Entry::childen_t::iterator next;
@ -209,8 +209,8 @@ private:
if (j == entry.mChildren.end ())
{
entry.mChildren [ch].mValue = /*std::move*/ (value);
entry.mChildren [ch].mKeyword = /*std::move*/ (keyword);
entry.mChildren [ch].mValue = std::move (value);
entry.mChildren [ch].mKeyword = std::move (keyword);
}
else
{
@ -219,22 +219,22 @@ private:
if (keyword == j->second.mKeyword)
throw std::runtime_error ("duplicate keyword inserted");
value_t pushValue = /*std::move*/ (j->second.mValue);
string_t pushKeyword = /*std::move*/ (j->second.mKeyword);
value_t pushValue = j->second.mValue;
string_t pushKeyword = j->second.mKeyword;
if (depth >= pushKeyword.size ())
throw std::runtime_error ("unexpected");
if (depth+1 < pushKeyword.size())
{
seed_impl (/*std::move*/ (pushKeyword), /*std::move*/ (pushValue), depth+1, j->second);
seed_impl (std::move (pushKeyword), std::move (pushValue), depth+1, j->second);
j->second.mKeyword.clear ();
}
}
if (depth+1 == keyword.size())
j->second.mKeyword = value;
else // depth+1 < keyword.size()
seed_impl (/*std::move*/ (keyword), /*std::move*/ (value), depth+1, j->second);
seed_impl (std::move (keyword), std::move (value), depth+1, j->second);
}
}