[PATCH] D52047: [clangd] Add a "benchmark" for tracking memory
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 20 01:26:19 PDT 2018
kbobyrev 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".
----------------
ioeric wrote:
> 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?
Yes, that makes sense. I might try to use [[ https://github.com/google/benchmark#user-defined-counters | User-Defined Counters ]] for that.
================
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;
----------------
ioeric wrote:
> Why do we need `P.second.bytes() * sizeof(DocID)`? Isn't `P.second.bytes()` already the memory size of the posting list?
Yes, the patch is out of sync. Will fix!
https://reviews.llvm.org/D52047
More information about the cfe-commits
mailing list