From: Duy Nguyen Date: Mon, 20 Jan 2014 01:36:48 GMT Subject: Re: [PATCH/WIP v2 05/14] read-cache: put some limits on file watching Message-ID: In-Reply-To: <87ha8zewas.fsf@thomasrast.ch> On Mon, Jan 20, 2014 at 12:06 AM, Thomas Rast wrote: > Nguyễn Thái Ngọc Duy writes: > >> watch_entries() is a lot of computation and could trigger a lot more >> lookups in file-watcher. Normally after the first set of watches are >> in place, we do not need to update often. Moreover if the number of >> entries is small, the overhead of file watcher may actually slow git >> down. >> >> This patch only allows to update watches if the number of watchable >> files is over a limit (and there are new files added if this is not >> the first time). Measurements on Core i5-2520M and Linux 3.7.6, about >> 920 lstat() take 1ms. Somewhere between 2^16 and 2^17 lstat calls that >> it starts to take longer than 100ms. 2^16 is chosen at the minimum >> limit to start using file watcher. >> >> Recently updated files are not considered watchable because they are >> likely to be updated again soon, not worth the ping-pong game with >> file watcher. The default limit 30min is just a random value. > > But then a fresh clone of a big repository would not get any benefit > from the watcher? > > Not yet sure how to best handle this. Gaahh, perhaps limit the number of unwatchable recent files to a hundred or so in addition to time limit. -- Duy