[PATCH] D98371: [clangd] Group filename calculations in SymbolCollector, and cache mroe.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 10 14:23:30 PST 2021


sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

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%)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98371

Files:
  clang-tools-extra/clangd/index/CanonicalIncludes.cpp
  clang-tools-extra/clangd/index/CanonicalIncludes.h
  clang-tools-extra/clangd/index/FileIndex.cpp
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/SymbolCollector.h
  clang-tools-extra/clangd/unittests/CanonicalIncludesTests.cpp
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98371.329774.patch
Type: text/x-patch
Size: 28421 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210310/69983e33/attachment-0001.bin>


More information about the cfe-commits mailing list