Re: inotify to minimize stat() calls
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Feb 11, 2013, 03:53 UTC
- Message-ID
- <CACsJy8AWyJ=dW5f44huWyPPe4X62xyi+R9CNM5Tg6u6TYf+thQ@mail.gmail.com>
- In-Reply-To
- <CABPQNSZ282Lre=sy-+ZQdJA9JnGqQguq2bQDOwvjb0fP+1-w8Q@mail.gmail.com>
On Sun, Feb 10, 2013 at 11:58 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
Show 7 quoted lines
> Karsten Blees has done something similar-ish on Windows, and he posted > the results here: > > https://groups.google.com/forum/#!topic/msysgit/fL_jykUmUNE/discussion > > I also seem to remember he doing a ReadDirectoryChangesW version, but > I don't remember what happened with that.
Thanks. I came across that but did not remember. For one thing, we know the inotify alternative for Windows: ReadDirectoryChangesW.
But the meat of the patch is not about that function. In fact it's dropped in fscache-v3 [1]. It seems that doing FindFirstFile/FindNextFile for an entire directory, cache the results and use it to simulate lstat() is faster on Windows. Sounds similar to preload-index. And because directory listing is cached anyway, opendir/readdir is replaced to read from cache instead of opening the directory again.
So it is orthogonal with using ReadDirectoryChangesW/inotify to further reduce the system calls.
I copy "git status"'s (impressive) numbers from fscache-v0 for those who are interested in:
preload | -u | normal | cached | gain --------+-----+--------+--------+------ false | all | 25.144 | 3.055 | 8.2 false | no | 22.822 | 1.748 | 12.8 true | all | 9.234 | 2.179 | 4.2 true | no | 6.833 | 0.955 | 7.2
[1] https://github.com/kblees/git/commit/35f319609aa046d2350db32d3afa1fa44920e880
-- Duy