This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Group filename calculations in SymbolCollector, and cache mroe.
ClosedPublic

Authored by sammccall on Mar 10 2021, 2:23 PM.

Details

Summary

Also give CanonicalIncludes a less powerful interface (canonicalizes
symbols vs headers separately) so we can cache its results better.

Prior to this:

  • path->uri conversions were not consistently cached, this is particularly cheap when we start from a FileEntry* (which we often can)
  • only a small fraction of header-to-include calculation was cached

This is a significant speedup at least for dynamic indexing of preambles.
On my machine, opening XRefs.cpp:

PreambleCallback 1.208 -> 1.019 (-15.7%)
BuildPreamble    5.538 -> 5.214 (-5.8%)

Diff Detail

Event Timeline

sammccall created this revision.Mar 10 2021, 2:23 PM
sammccall requested review of this revision.Mar 10 2021, 2:23 PM
kadircet accepted this revision.Mar 11 2021, 3:49 AM

the savings look great, thanks!

clang-tools-extra/clangd/index/SymbolCollector.cpp
217

i don't think the comments are applicable anymore, this was talking about the makeAbsolute inside getCanonicalPath, which is no longer the only call path.

323

why do we need this now?

720

s/definiting/defining

clang-tools-extra/clangd/index/SymbolCollector.h
176

is this intentional ?

This revision is now accepted and ready to land.Mar 11 2021, 3:49 AM
This revision was landed with ongoing or failed builds.Mar 11 2021, 3:59 AM
This revision was automatically updated to reflect the committed changes.
sammccall marked 4 inline comments as done.