[all-commits] [llvm/llvm-project] b8c583: [clangd] Group filename calculations in SymbolColl...

Sam McCall via All-commits all-commits at lists.llvm.org
Thu Mar 11 03:59:47 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b8c58374f66b2a03ff3f48c419037d463c5b80ed
      https://github.com/llvm/llvm-project/commit/b8c58374f66b2a03ff3f48c419037d463c5b80ed
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2021-03-11 (Thu, 11 Mar 2021)

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

  Log Message:
  -----------
  [clangd] Group filename calculations in SymbolCollector, and cache mroe.

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

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




More information about the All-commits mailing list