[PATCH] D52047: [clangd] Add a "benchmark" for tracking memory

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 19 01:42:44 PDT 2018


ioeric added inline comments.


================
Comment at: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp:69
 
+// This is not a *real* benchmark: it shows size of built MemIndex (in bytes).
+// Same for the next "benchmark".
----------------
The hack might not be obvious for other people who run these benchmarks. Is it possible to print some extra message along with the result to explain the hack? 


================
Comment at: clang-tools-extra/clangd/index/dex/Dex.cpp:239
   for (const auto &P : InvertedIndex)
-    Bytes += P.second.bytes();
+    Bytes += P.first.Data.size() + P.second.bytes() * sizeof(DocID);
   return Bytes + BackingDataSize;
----------------
Why do we need `P.second.bytes() * sizeof(DocID)`? Isn't `P.second.bytes()` already the memory size of the posting list?


https://reviews.llvm.org/D52047





More information about the cfe-commits mailing list