Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
8a20b6c1
Unverified
Commit
8a20b6c1
authored
Jun 21, 2020
by
IzabelaMazur
Committed by
GitHub
Jun 21, 2020
Browse files
[Optimization] Replaced std::unordered_map by phmap::flat_hash_map (#1662)
Co-authored-by:
Da Zheng
<
zhengda1936@gmail.com
>
parent
3d47693b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
+7
-2
.gitmodules
.gitmodules
+3
-0
src/array/cpu/array_utils.h
src/array/cpu/array_utils.h
+3
-2
third_party/phmap
third_party/phmap
+1
-0
No files found.
.gitmodules
View file @
8a20b6c1
...
...
@@ -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
src/array/cpu/array_utils.h
View file @
8a20b6c1
...
...
@@ -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_
;
};
/*
...
...
phmap
@
25293cef
Subproject commit 25293cefd8b85491b45600c03fe8edf07647553f
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment