[PATCH] D148088: [RFC][clangd] Move preamble index task to a seperate task

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 27 08:43:04 PDT 2023


ilya-biryukov added a comment.

In D148088#4302182 <https://reviews.llvm.org/D148088#4302182>, @kuganv wrote:

> 1. We see preamble indexing taking as much as 18% of the time for some files.  Moving  preamble indexing out of the critical path helps there.

Which operation are you measuring? 18% of first diagnostic latency?
Preamble indexing populates necessary information for many of the Clangd features. Some examples of the top of my head:

- code completion will not show declarations from preamble if they were not deserialized from the preamble (most symbols).
- diagnostics from preamble,
- multi-file rename will miss references inside template bodies.

Doing indexing of the preamble in parallel to other operations is probably an improvement as PCH gets available earlier for operations that need it, e.g. code completion can start operating faster.
However, if we want to ensure the returned results are the same as they were before the patch (at least for the first run), we have to synchronize with the operations that populates the index.

For any form of this optimization, I think the implementation is going to be a little tricky and we definitely want @kadircet to take a look at it. It's hard to list all things in Clangd that rely on preamble indexing
finishing before they run, this change definitely requires a careful design review.

> 2. We are also experimenting with preamble caching with clang modules. Early results from this also shows that preamble indexing outside  the critical path improves performance.

Could you elaborate a bit more on what is being cached with modules and how this patch would affect it?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148088/new/

https://reviews.llvm.org/D148088



More information about the cfe-commits mailing list