Skip to content

Commit

Permalink
use parallel-hashmap
Browse files Browse the repository at this point in the history
  • Loading branch information
atetubou committed Jun 13, 2024
1 parent 0b4b43a commit eeae96c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "parallel-hashmap"]
path = parallel-hashmap
url = https://github.com/greg7mdp/parallel-hashmap.git
2 changes: 2 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ def search_system_path(file_name: str) -> Optional[str]: # type: ignore # Missi
# Disable size_t -> int truncation warning.
# We never have strings or arrays larger than 2**31.
'/wd4267',
'/Iparallel-hashmap',
'/DNOMINMAX', '/D_CRT_SECURE_NO_WARNINGS',
'/D_HAS_EXCEPTIONS=0',
'/DNINJA_PYTHON="%s"' % options.with_python]
Expand All @@ -363,6 +364,7 @@ def search_system_path(file_name: str) -> Optional[str]: # type: ignore # Missi
'-fno-exceptions',
'-std=c++11',
'-fvisibility=hidden', '-pipe',
'-Iparallel-hashmap',
'-DNINJA_PYTHON="%s"' % options.with_python]
if options.debug:
cflags += ['-D_GLIBCXX_DEBUG', '-D_GLIBCXX_DEBUG_PEDANTIC']
Expand Down
1 change: 1 addition & 0 deletions parallel-hashmap
Submodule parallel-hashmap added at d88c5e
6 changes: 3 additions & 3 deletions src/hash_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include <algorithm>
#include <string.h>
#include "parallel_hashmap/phmap.h"
#include "parallel_hashmap/phmap_utils.h"
#include "string_piece.h"
#include "util.h"

Expand Down Expand Up @@ -53,8 +55,6 @@ unsigned int MurmurHash2(const void* key, size_t len) {
return h;
}

#include <unordered_map>

namespace std {
template<>
struct hash<StringPiece> {
Expand All @@ -73,7 +73,7 @@ struct hash<StringPiece> {
/// mapping StringPiece => Foo*.
template<typename V>
struct ExternalStringHashMap {
typedef std::unordered_map<StringPiece, V> Type;
typedef phmap::flat_hash_map<StringPiece, V> Type;
};

#endif // NINJA_MAP_H_

0 comments on commit eeae96c

Please sign in to comment.