hgwatchman: inotify that works

Siddharth Agarwal sid0 at fb.com
Mon Sep 2 16:03:21 CDT 2013


On 09/02/2013 01:09 PM, Martin Geisler wrote:
> Siddharth Agarwal <sid0 at fb.com> writes:
>
> Hey!
>
> That's really cool! Thanks for the hard work you guys are putting into
> Mercurial.
>
> I tried it (after fixing some small 32-bit build errors in watchman)

If you have time, patches for them would be appreciated. We don't have 
CI set up for 32-bit builds on any OS, so they invariably break.

> with the OpenOffice repo where there are 69k files in the working copy.
> The repo is on a SSD and the time went from 0.5 sec to 0.17 sec.

That sounds about right. I'd suspect the benefits of such an extension 
show up only once you hit 100-150k files or so.

> For fun, I tried with the statdaemon extension I wrote a long time ago.
> There I didn't see any performance improvement when I turned it on.
>
> I haven't looked at watchman in detail, but do they do something like I
> had to do here to make sure I get a consistent view of the filesystem:
>
>    https://bitbucket.org/aragost/statdaemon/src/tip/shared.py#cl-60
>
> That is, touch a well-known file and wait until the event thus generated
> is seen. Assuming that FS events are delivered in FIFO order, the daemon
> knows that it has seen all events up to the time it was called when it
> sees the touched file.

Yes, that's basically what we do, though we use temporary files instead. 
See 
https://github.com/facebook/watchman/blob/master/docs/cookies.markdown. 
It took us a few iterations to get exactly right, though, and it still 
isn't fully correct on non-Linux systems.


More information about the Mercurial-devel mailing list