Skip to content
Snippets Groups Projects
Commit d3ed9488 authored by Alexander Gavriliuk's avatar Alexander Gavriliuk
Browse files

SL-20140 Optimization LLDictionary::addEntry() - avoid of double search

parent 9d981c72
No related branches found
No related tags found
No related merge requests found
...@@ -87,11 +87,10 @@ class LLDictionary : public std::map<Index, Entry *> ...@@ -87,11 +87,10 @@ class LLDictionary : public std::map<Index, Entry *>
} }
void addEntry(Index index, Entry *entry) void addEntry(Index index, Entry *entry)
{ {
if (lookup(index)) if (!insert(value_type(index, entry)).second)
{ {
LL_ERRS() << "Dictionary entry already added (attempted to add duplicate entry)" << LL_ENDL; LL_ERRS() << "Dictionary entry already added (attempted to add duplicate entry)" << LL_ENDL;
} }
(*this)[index] = entry;
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment