mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-22 11:23:27 -04: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:
parent
031871cd48
commit
af759683b8
@ -30,7 +30,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (keyword.empty())
|
if (keyword.empty())
|
||||||
return;
|
return;
|
||||||
seed_impl (/*std::move*/ (keyword), /*std::move*/ (value), 0, mRoot);
|
seed_impl (std::move(keyword), std::move (value), 0, mRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear ()
|
void clear ()
|
||||||
@ -39,7 +39,7 @@ public:
|
|||||||
mRoot.mKeyword.clear ();
|
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 current;
|
||||||
typename Entry::childen_t::iterator next;
|
typename Entry::childen_t::iterator next;
|
||||||
@ -209,8 +209,8 @@ private:
|
|||||||
|
|
||||||
if (j == entry.mChildren.end ())
|
if (j == entry.mChildren.end ())
|
||||||
{
|
{
|
||||||
entry.mChildren [ch].mValue = /*std::move*/ (value);
|
entry.mChildren [ch].mValue = std::move (value);
|
||||||
entry.mChildren [ch].mKeyword = /*std::move*/ (keyword);
|
entry.mChildren [ch].mKeyword = std::move (keyword);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -219,22 +219,22 @@ private:
|
|||||||
if (keyword == j->second.mKeyword)
|
if (keyword == j->second.mKeyword)
|
||||||
throw std::runtime_error ("duplicate keyword inserted");
|
throw std::runtime_error ("duplicate keyword inserted");
|
||||||
|
|
||||||
value_t pushValue = /*std::move*/ (j->second.mValue);
|
value_t pushValue = j->second.mValue;
|
||||||
string_t pushKeyword = /*std::move*/ (j->second.mKeyword);
|
string_t pushKeyword = j->second.mKeyword;
|
||||||
|
|
||||||
if (depth >= pushKeyword.size ())
|
if (depth >= pushKeyword.size ())
|
||||||
throw std::runtime_error ("unexpected");
|
throw std::runtime_error ("unexpected");
|
||||||
|
|
||||||
if (depth+1 < pushKeyword.size())
|
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 ();
|
j->second.mKeyword.clear ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (depth+1 == keyword.size())
|
if (depth+1 == keyword.size())
|
||||||
j->second.mKeyword = value;
|
j->second.mKeyword = value;
|
||||||
else // depth+1 < keyword.size()
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user