1
0
Fork 0

move static variable from function into TU scope

This commit is contained in:
jsteemann 2019-10-22 16:04:55 +02:00
parent 02760bff67
commit d6d8f321e7
1 changed files with 5 additions and 5 deletions

View File

@ -64,13 +64,13 @@ arangodb::velocypack::StringRef const SortModeUnset("unset");
arangodb::velocypack::StringRef const SortModeMinElement("minelement");
arangodb::velocypack::StringRef const SortModeHeap("heap");
bool toSortMode(arangodb::velocypack::StringRef const& str, GatherNode::SortMode& mode) noexcept {
// std::map ~25-30% faster than std::unordered_map for small number of elements
static std::map<arangodb::velocypack::StringRef, GatherNode::SortMode> const NameToValue{
std::map<arangodb::velocypack::StringRef, GatherNode::SortMode> const NameToValue{
{SortModeMinElement, GatherNode::SortMode::MinElement},
{SortModeHeap, GatherNode::SortMode::Heap},
{SortModeUnset, GatherNode::SortMode::Default}};
bool toSortMode(arangodb::velocypack::StringRef const& str, GatherNode::SortMode& mode) noexcept {
// std::map ~25-30% faster than std::unordered_map for small number of elements
auto const it = NameToValue.find(str);
if (it == NameToValue.end()) {