[PATCH] D53363: [clangd] Encode Line/Column as a 32-bits integer.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 18 02:11:30 PDT 2018
hokein added a comment.
> In https://reviews.llvm.org/D53363#1267721, @hokein wrote:
>
>> Yeah, I have a rough patch for it, using char* will save us ~50MB memory, which will lead to ~300 MB memory usage in total.
>
>
> For just the StringRef in SymbolLocation::Position, or for all our strings?
> If the latter, that seems too low, as we should save strictly more than this patch (unless I'm missing something about alignment/padding)
This is just for the StringRef in `Position`, I think it matches our estimation.
More details coming:
- 6.4 million refs, 6.4m * 40 bytes = ~250MB
- 0.3 million symbols, 0.3m * 248 bytes = ~70MB
The original size of `Ref` (before any space optimization) is 40 bytes, we save 8 bytes per refs, 8*6.5 = ~50 MB; If we change all StringRef in `Symbol` to `char*`, which will save 64 bytes (8*8) per sym, 64*0.3v = ~19 MB, which doesn't gain as much as refs, as refs contributes more than 70% memory.
================
Comment at: clangd/index/Index.h:66
const SymbolLocation::Position &R) {
- return std::tie(L.Line, L.Column) == std::tie(R.Line, R.Column);
+ return std::make_tuple(L.line(), L.column()) ==
+ std::make_tuple(R.Line, R.Column);
----------------
sammccall wrote:
> Why only using the getters on one side?
Oops, I mis-thought the type of the right side LSP position, fixed.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D53363
More information about the cfe-commits
mailing list