[clangd] Build Dex index after loading all shards in BackgroundIndex.
authorHaojian Wu <hokein@google.com>
Thu, 14 Mar 2019 09:57:10 +0000 (09:57 +0000)
committerHaojian Wu <hokein@google.com>
Thu, 14 Mar 2019 09:57:10 +0000 (09:57 +0000)
Summary:
Currently after loadding all shards, we use MemIndex which has poor query
performance, we should use Dex.

Reviewers: kadircet

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D59350

llvm-svn: 356126

clang-tools-extra/clangd/index/Background.cpp

index 79f2125..8aa5982 100644 (file)
@@ -374,7 +374,9 @@ void BackgroundIndex::buildIndex() {
     // extra index build.
     reset(
         IndexedSymbols.buildIndex(IndexType::Heavy, DuplicateHandling::Merge));
-    log("BackgroundIndex: rebuilt symbol index.");
+    log("BackgroundIndex: rebuilt symbol index with estimated memory {0} "
+        "bytes.",
+        estimateMemoryUsage());
   }
 }
 
@@ -603,8 +605,10 @@ BackgroundIndex::loadShards(std::vector<std::string> ChangedFiles) {
     }
   }
   vlog("Loaded all shards");
-  reset(IndexedSymbols.buildIndex(IndexType::Light, DuplicateHandling::Merge));
-
+  reset(IndexedSymbols.buildIndex(IndexType::Heavy, DuplicateHandling::Merge));
+  vlog("BackgroundIndex: built symbol index with estimated memory {0} "
+       "bytes.",
+       estimateMemoryUsage());
   return NeedsReIndexing;
 }