[all-commits] [llvm/llvm-project] ff616f: [clangd] Cache config files for 5 seconds, without...

Sam McCall via All-commits all-commits at lists.llvm.org
Tue Jul 14 08:02:38 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ff616f74c3b45e0890b53d92fcfc6a9d18f4bfdd
      https://github.com/llvm/llvm-project/commit/ff616f74c3b45e0890b53d92fcfc6a9d18f4bfdd
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2020-07-14 (Tue, 14 Jul 2020)

  Changed paths:
    M clang-tools-extra/clangd/ClangdServer.cpp
    M clang-tools-extra/clangd/ConfigProvider.cpp
    M clang-tools-extra/clangd/ConfigProvider.h
    M clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp

  Log Message:
  -----------
  [clangd] Cache config files for 5 seconds, without revalidating with stat.

Summary:
This is motivated by:
 - code completion: nice to do no i/o on the request path
 - background index: deciding whether to enqueue each file would stat the config
   file thousands of times in quick succession.

Currently it's applied uniformly to all requests though.

This gives up on performing stat() outside the lock, all this achieves is
letting multiple threads stat concurrently (and thus finish without contention
for nonexistent files).
The ability to finish without IO (just mutex lock + integer check) should
outweigh this, and is less sensitive to platform IO characteristics.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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




More information about the All-commits mailing list