This patch prints information about built index size estimation to verbose logs. This is useful for optimizing memory usage of DexIndex and comparisons with MemIndex.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
clang-tools-extra/clangd/index/MemIndex.cpp | ||
---|---|---|
105 ↗ | (On Diff #162141) | access to Index needs to be guarded by mutex |
105 ↗ | (On Diff #162141) | Index.getMemorySize() is a better estimate. |
clang-tools-extra/clangd/index/MemIndex.h | ||
43 ↗ | (On Diff #162141) | Can you return bytes here, and do lossy conversions at display time instead? (Not sure the conversions are even worth it. e.g. it's may be interesting to compare even <1mb indexes) |
44 ↗ | (On Diff #162141) | I'd suggest making this part of the public interface, and implementing it for all (the implementations should be trivial). This is useful e.g. for monitoring. We may want vim's :YcmDebugInfo to return this, etc. |
clang-tools-extra/clangd/index/dex/DexIndex.cpp | ||
178 ↗ | (On Diff #162141) | again, LookupTable.getMemorySize() and others. |
180 ↗ | (On Diff #162141) | I think you're not counting the size of the actual symbols. |
182 ↗ | (On Diff #162141) | why is only the InvertedIndex access guarded by the mutex? |
clang-tools-extra/clangd/index/dex/DexIndex.cpp | ||
---|---|---|
180 ↗ | (On Diff #162141) | As discussed offline: I should put a FIXME and leave it for later. |
Do we plan to expose an API in ClangdServer to allow C++ API users to track index memory usages?
clang-tools-extra/clangd/index/FileIndex.cpp | ||
---|---|---|
123 ↗ | (On Diff #162184) | I think the URI scheme names should be negligible. |
clang-tools-extra/clangd/index/dex/DexIndex.cpp | ||
180 ↗ | (On Diff #162141) | SymbolSlab provides a pretty good estimation of memory usage, and I think we should try to use if possible (as Sam suggested, it could be misleading without the size of index corpus). IIUC, the challenge here is that SymbolSlabs can be hiden behind shared_ptr, and index might not have access to the underlying slabs. If that's the case, I think it would be reasonable to ask callers of build to also pass in an estimated size of the hidden slabs? |
I think we do, IIUC the conclusion of the offline discussion was that it might be useful for the clients. However, that would require SymbolSlab estimation, too (which is probably out of scope of this patch).