This is an archive of the discontinued LLVM Phabricator instance.

[Index] Reduce size of SymbolInfo struct.
ClosedPublic

Authored by sammccall on Dec 21 2017, 2:13 PM.

Details

Summary

This is currently 16 bytes, the patch reduces it to 4.
(Building with clang on linux x84, I guess others are similar)

The only subfield that might need a bigger type is SymbolPropertySet,
I've moved it to the end of the struct so if it grows, SymbolInfo will
only be 8 bytes.

With a full index of namespace-scope symbols from the LLVM project (200k)
loaded into clangd, this saves ~2MB of RAM.

Diff Detail

Event Timeline

sammccall created this revision.Dec 21 2017, 2:13 PM

Nice one! One minor change I'd suggest is to change SymbolProperty to enum class SymbolProperty : SymbolPropertySet, so that if it needs to increase we only change the type in one place.

Avoid repeating uint8_t type for SymbolProperty/SymbolPropertySet.

akyrtzi accepted this revision.Dec 23 2017, 9:51 AM

LGTM!

This revision is now accepted and ready to land.Dec 23 2017, 9:51 AM
This revision was automatically updated to reflect the committed changes.