Skip to content

Commit af064c8

Browse files
committed
DependencyGraph: use std::unordered_map, not std::map, for O(1) lookup
1 parent 3022d0c commit af064c8

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/base/dependencygraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using namespace icinga;
66

77
std::mutex DependencyGraph::m_Mutex;
8-
std::map<ConfigObject*, std::map<ConfigObject*, int>> DependencyGraph::m_Dependencies;
8+
std::unordered_map<ConfigObject*, std::unordered_map<ConfigObject*, int>> DependencyGraph::m_Dependencies;
99

1010
void DependencyGraph::AddDependency(ConfigObject* child, ConfigObject* parent)
1111
{

lib/base/dependencygraph.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include "base/i2-base.hpp"
77
#include "base/configobject.hpp"
8-
#include <map>
8+
#include <unordered_map>
99
#include <mutex>
1010

1111
namespace icinga {
@@ -36,7 +36,7 @@ class DependencyGraph
3636
DependencyGraph();
3737

3838
static std::mutex m_Mutex;
39-
static std::map<ConfigObject*, std::map<ConfigObject*, int>> m_Dependencies;
39+
static std::unordered_map<ConfigObject*, std::unordered_map<ConfigObject*, int>> m_Dependencies;
4040
};
4141

4242
}

0 commit comments

Comments
 (0)