Unverified Commit 8a20b6c1 authored by IzabelaMazur's avatar IzabelaMazur Committed by GitHub
Browse files

[Optimization] Replaced std::unordered_map by phmap::flat_hash_map (#1662)


Co-authored-by: default avatarDa Zheng <zhengda1936@gmail.com>
parent 3d47693b
......@@ -13,3 +13,6 @@
[submodule "third_party/METIS"]
path = third_party/METIS
url = https://github.com/KarypisLab/METIS.git
[submodule "third_party/phmap"]
path = third_party/phmap
url = https://github.com/greg7mdp/parallel-hashmap.git
......@@ -11,6 +11,7 @@
#include <unordered_map>
#include <utility>
#include "../../c_api_common.h"
#include "../third_party/phmap/parallel_hashmap/phmap.h"
namespace dgl {
namespace aten {
......@@ -51,7 +52,7 @@ class IdHashMap {
const int64_t len = ids->shape[0];
for (int64_t i = 0; i < len; ++i) {
const IdType id = ids_data[i];
// std::unorderd_map::insert assures that an insertion will not happen if the
// phmap::flat_hash_map::insert assures that an insertion will not happen if the
// key already exists.
oldv2newv_.insert({id, oldv2newv_.size()});
filter_[id & kFilterMask] = true;
......@@ -105,7 +106,7 @@ class IdHashMap {
// Hashtable is very slow. Using bloom filter can significantly speed up lookups.
std::vector<bool> filter_;
// The hashmap from old vid to new vid
std::unordered_map<IdType, IdType> oldv2newv_;
phmap::flat_hash_map<IdType, IdType> oldv2newv_;
};
/*
......
Subproject commit 25293cefd8b85491b45600c03fe8edf07647553f
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment