From 22cc140d80e7fffa1e9b6c31808dba6add4cfa56 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Fri, 7 Apr 2017 18:35:12 -0700 Subject: [PATCH] use sparsehash --- .gitmodules | 3 +++ src/query.h | 9 ++++++++- third_party/sparsehash | 1 + wscript | 5 +++-- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 160000 third_party/sparsehash diff --git a/.gitmodules b/.gitmodules index fbe945c5..8dd505f9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "third_party/doctest"] path = third_party/doctest url = https://github.com/onqtam/doctest +[submodule "third_party/sparsehash"] + path = third_party/sparsehash + url = https://github.com/sparsehash/sparsehash diff --git a/src/query.h b/src/query.h index 47867489..1c94e54b 100644 --- a/src/query.h +++ b/src/query.h @@ -3,6 +3,8 @@ #include "indexer.h" #include "serializer.h" +#include + using Usr = std::string; struct QueryableFile; @@ -234,7 +236,12 @@ struct QueryableDatabase { std::vector vars; // Lookup symbol based on a usr. - std::unordered_map usr_to_symbol; + google::dense_hash_map usr_to_symbol; + + QueryableDatabase() { + usr_to_symbol.set_empty_key(""); + } + //std::unordered_map usr_to_symbol; // Insert the contents of |update| into |db|. void ApplyIndexUpdate(IndexUpdate* update); diff --git a/third_party/sparsehash b/third_party/sparsehash new file mode 160000 index 00000000..4cb92402 --- /dev/null +++ b/third_party/sparsehash @@ -0,0 +1 @@ +Subproject commit 4cb924025b8c622d1a1e11f4c1e9db15410c75fb diff --git a/wscript b/wscript index aceb42e1..63dfb406 100644 --- a/wscript +++ b/wscript @@ -88,15 +88,16 @@ def build(bld): excl=['libcxx/*', '*tests/*', 'third_party/*']) bld.program( source=cc_files, - cxxflags=['-std=c++11', '-Wall'], + cxxflags=['-O3', '-std=c++11', '-Wall'], includes=[ 'third_party/', 'third_party/doctest/', 'third_party/rapidjson/include', + 'third_party/sparsehash/src', CLANG_INCLUDE_DIR], lib=[ 'clang', - #'rt', + 'rt', 'pthread'], libpath=[CLANG_LIB_DIR], rpath=[CLANG_LIB_DIR],