Skip to content

Commit

Permalink
Make DependencyGraph::m_Dependencies a hashmap to increase lookup speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Aug 9, 2023
1 parent 8f2eb1c commit c6de24b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/base/dependencygraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using namespace icinga;

std::shared_mutex DependencyGraph::m_Mutex;
std::map<Object *, std::map<Object *, int> > DependencyGraph::m_Dependencies;
std::unordered_map<Object *, std::unordered_map<Object *, int>> DependencyGraph::m_Dependencies;

void DependencyGraph::AddDependency(Object *parent, Object *child)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/base/dependencygraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include "base/i2-base.hpp"
#include "base/object.hpp"
#include <map>
#include <shared_mutex>
#include <unordered_map>

namespace icinga {

Expand All @@ -26,7 +26,7 @@ class DependencyGraph
DependencyGraph();

static std::shared_mutex m_Mutex;
static std::map<Object *, std::map<Object *, int> > m_Dependencies;
static std::unordered_map<Object *, std::unordered_map<Object *, int>> m_Dependencies;
};

}
Expand Down

0 comments on commit c6de24b

Please sign in to comment.