[PATCH] D83755: [clangd] Cache config files for 5 seconds, without revalidating with stat.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 14 02:37:59 PDT 2020


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

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83755

Files:
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ConfigProvider.cpp
  clang-tools-extra/clangd/ConfigProvider.h
  clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83755.277723.patch
Type: text/x-patch
Size: 7875 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200714/360b348e/attachment-0001.bin>


More information about the cfe-commits mailing list