[clang-tools-extra] Symbol tags in SymbolInformation, WorkspaceSymbol, CallHierarchyItem and TypeHierarchyItem (PR #170103)

Dimitri Ratz via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 03:25:49 PDT 2026


ratzdi wrote:

> > > preliminary results:
> > > clangd version > 	18.01.3 	this branch 	main @07ff1a63
> > > background index 	~1400 MB 	~2972 MB 	~2903 MB
> > > index cache disk usage 	~159 MB 	~188 MB 	~187 MB
> > 
> > 
> > Unrelated to this patch but, wow, that doubling of the index memory usage between 18.x and trunk is quite something. That probably deserves to be spun out into a separate issue and investigated further.
> 
> I cannot explain how the outlier occurred in the first measurement with 18.1.3. In the second measurement with 18.1.3, the memory/disc consumption is now more consistent.
> 
> current results:
>  clangd version > 	18.1.3 	this branch 	main @07ff1a63
> background index 	~2721 MB 	~2972 MB 	~2903 MB
> index cache disk usage 	~184 MB 	~188 MB 	~187 MB

Minor change on `struct Symbol` to minimize paddings:

64-bit

The problematic areas are:

SymInfo (6 bytes) → followed by a 2-byte gap
Origin (2 bytes) → followed by a 2-byte gap before StringRef
Tags (4 bytes) → followed by a 4-byte gap before SmallVector
Flags at the end → 7 bytes end padding

32-bit

SymInfo → 2-byte gap
Origin → 2-byte gap
Flags at the end → 3 bytes end padding


current results for the patch f99012b5:
 clangd version > | 18.1.3 | this branch | this branch @f99012b5 | main @07ff1a63
-- | -- | -- | -- | --
background index | ~2721 MB | ~2972 MB | ~2810 MB | ~2903 MB
index cache disk usage | ~184 MB | ~188 MB | ~188 MB | ~187 MB


This patch f99012b5 reduces paddings:
64-bit: 240 -> 232 (-8 Bytes, ~3.3%)
32-bit: 144 -> 140 (-4 Bytes, ~2.8%)

https://github.com/llvm/llvm-project/pull/170103


More information about the cfe-commits mailing list