[PATCH] D52549: [VFS] Add a VFS wrapper which avoids opening nonexistent files by reading dirs.
Eric Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 27 03:34:06 PDT 2018
ioeric added a comment.
This looks like a great improvement. The design looks reasonable to me. The cache states were a bit confusing at first, but I think more documentation when polishing the prototype could help.
I'd be really interested in seeing some profiles before/after this optimization e.g. for clang or clangd.
================
Comment at: lib/Basic/AvoidStatsVFS.cpp:44
+
+class StatLessFS : public ProxyFileSystem {
+public:
----------------
`LessStatFS` sounds more accurate lol
================
Comment at: lib/Basic/AvoidStatsVFS.cpp:46
+public:
+ // In fact we only read a directory once we've wanted its contents several
+ // times. This avoids a common pattern:
----------------
The comment is very clear, but it's hard to tell how it relates to `ReadDirThreshold = 3`.
================
Comment at: lib/Basic/AvoidStatsVFS.cpp:186
+ // - NormPath is a directory whose children can't be listed
+ bool populateCacheForDir(StringRef NormPath) {
+ // First, just see if we have any work to do.
----------------
Is there any overhead for reading all parent directories, e.g. when directories are large? Or would they be read anyway somewhere else?
Repository:
rC Clang
https://reviews.llvm.org/D52549
More information about the cfe-commits
mailing list