[clangd] Encode Line/Column as a 32-bits integer.
authorHaojian Wu <hokein@google.com>
Thu, 18 Oct 2018 10:43:50 +0000 (10:43 +0000)
committerHaojian Wu <hokein@google.com>
Thu, 18 Oct 2018 10:43:50 +0000 (10:43 +0000)
commitb515fabb3bca172f13a52d144824b56180dad158
tree8e42e51c85f40ccc3ead9705d52e028a91a6a882
parent59041687bee841f46c520f4b6a7cb8f97b4efd05
[clangd] Encode Line/Column as a 32-bits integer.

Summary:
This would buy us more memory. Using a 32-bits integer is enough for
most human-readable source code (up to 4M lines and 4K columns).

Previsouly, we used 8 bytes for a position, now 4 bytes, it would save
us 8 bytes for each Ref and each Symbol instance.

For LLVM-project binary index file, we save ~13% memory.

| Before | After |
| 412MB  | 355MB |

Reviewers: sammccall

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

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

llvm-svn: 344735
clang-tools-extra/clangd/FindSymbols.cpp
clang-tools-extra/clangd/XRefs.cpp
clang-tools-extra/clangd/index/Index.cpp
clang-tools-extra/clangd/index/Index.h
clang-tools-extra/clangd/index/Serialization.cpp
clang-tools-extra/clangd/index/SymbolCollector.cpp
clang-tools-extra/clangd/index/YAMLSerialization.cpp
clang-tools-extra/unittests/clangd/FileIndexTests.cpp
clang-tools-extra/unittests/clangd/IndexTests.cpp
clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp