[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-10-02 Thread Eric Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL343576: [clangd] Cache FS stat() calls when building preamble. (authored by ioeric, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D52419 Files:

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-10-02 Thread Eric Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rCTE343576: [clangd] Cache FS stat() calls when building preamble. (authored by ioeric, committed by ). Changed prior to commit: https://reviews.llvm.org/D52419?vs=167914=167915#toc Repository: rCTE

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-10-02 Thread Eric Liu via Phabricator via cfe-commits
ioeric updated this revision to Diff 167914. ioeric added a comment. - Rebase Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D52419 Files: clangd/CMakeLists.txt clangd/ClangdServer.cpp clangd/ClangdUnit.cpp clangd/ClangdUnit.h clangd/CodeComplete.cpp

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-10-02 Thread Eric Liu via Phabricator via cfe-commits
ioeric updated this revision to Diff 167913. ioeric added a comment. - add comment for StatCache in PreambleData Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D52419 Files: clangd/CMakeLists.txt clangd/ClangdServer.cpp clangd/ClangdUnit.cpp clangd/ClangdUnit.h

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-10-02 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision. sammccall added a comment. This revision is now accepted and ready to land. Sorry for dropping this. Comment at: clangd/ClangdUnit.h:58 IncludeStructure Includes; + std::unique_ptr StatCache; }; This deserves a comment,

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-27 Thread Eric Liu via Phabricator via cfe-commits
ioeric added inline comments. Comment at: clangd/FS.cpp:29 +PreambleFileStatusCache::lookup(llvm::StringRef File) const { + auto I = StatCache.find(File); + if (I != StatCache.end()) sammccall wrote: > ioeric wrote: > > sammccall wrote: > > > lock > > After a

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-27 Thread Eric Liu via Phabricator via cfe-commits
ioeric updated this revision to Diff 167370. ioeric marked 2 inline comments as done. ioeric added a comment. - Address review comments - address review comments - address review comments Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D52419 Files: clangd/CMakeLists.txt

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-27 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments. Comment at: clangd/FS.cpp:29 +PreambleFileStatusCache::lookup(llvm::StringRef File) const { + auto I = StatCache.find(File); + if (I != StatCache.end()) ioeric wrote: > sammccall wrote: > > lock > After a second thought, I'm

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-26 Thread Eric Liu via Phabricator via cfe-commits
ioeric added inline comments. Comment at: clangd/ClangdUnit.cpp:339 +llvm::ErrorOr status(const Twine ) override { + auto I = StatCache.find(Path.str()); + return (I != StatCache.end()) ? I->getValue() : FS->status(Path); ilya-biryukov wrote: >

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-26 Thread Eric Liu via Phabricator via cfe-commits
ioeric updated this revision to Diff 167124. ioeric marked 7 inline comments as done. ioeric added a comment. - address review comments Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D52419 Files: clangd/CMakeLists.txt clangd/ClangdServer.cpp clangd/ClangdUnit.cpp

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-26 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdUnit.cpp:339 +llvm::ErrorOr status(const Twine ) override { + auto I = StatCache.find(Path.str()); + return (I != StatCache.end()) ? I->getValue() : FS->status(Path); ioeric wrote: >

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-25 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment. Generally LG. A few things I'm unsure about. Comment at: clangd/CodeComplete.cpp:1028 + IntrusiveRefCntPtr VFS = Input.VFS; + if (Input.PreambleStatCache) ioeric wrote: > ilya-biryukov wrote: > > It feels like we could apply this

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-25 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a comment. Thanks for the reviews! Comment at: clangd/ClangdUnit.cpp:155 +auto S = FS->status(Path); +if (S) + cacheStatus(*S); sammccall wrote: > why are you only caching success? I had a comment in `openFileForRead`: ``` // Only

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-25 Thread Eric Liu via Phabricator via cfe-commits
ioeric updated this revision to Diff 166951. ioeric marked 10 inline comments as done. ioeric added a comment. Herald added a subscriber: mgorny. - Address review comments Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D52419 Files: clangd/CMakeLists.txt

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-25 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment. Nice win! This is missing high-level documentation explaining what problem it's trying to solve and what the lifetime is. I think pulling the factories out into a dedicated header would give you good space for that. Comment at:

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/ClangdUnit.cpp:119 +/// Collect and cache all file status from the underlying file system. +class CollectStatCacheVFS : public vfs::FileSystem { ioeric wrote: > Would it make sense to add a

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-24 Thread Eric Liu via Phabricator via cfe-commits
ioeric added inline comments. Comment at: clangd/ClangdUnit.cpp:119 +/// Collect and cache all file status from the underlying file system. +class CollectStatCacheVFS : public vfs::FileSystem { Would it make sense to add a `clang::vfs::ProxyFS` that proxies

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-24 Thread Eric Liu via Phabricator via cfe-commits
ioeric updated this revision to Diff 17. ioeric added a comment. - update comment Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D52419 Files: clangd/ClangdServer.cpp clangd/ClangdUnit.cpp clangd/ClangdUnit.h clangd/CodeComplete.cpp clangd/CodeComplete.h

[PATCH] D52419: [clangd] Cache FS stat() calls when building preamble.

2018-09-24 Thread Eric Liu via Phabricator via cfe-commits
ioeric created this revision. ioeric added reviewers: sammccall, ilya-biryukov. Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay. ioeric updated this revision to Diff 17. ioeric added a comment. - update comment The file stats can be reused when preamble is reused