GNU bug report logs - #44638
[PATCH 1/2] autorevert: don't reuse existing watch descriptors

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> catern.com>

Date: Sat, 14 Nov 2020 16:56:02 UTC

Severity: normal

Tags: patch

Fixed in version 28.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Spencer Baugh <sbaugh <at> catern.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 44638 <at> debbugs.gnu.org
Subject: bug#44638: [PATCH 1/2] autorevert: don't reuse existing watch descriptors
Date: Sat, 14 Nov 2020 16:19:07 -0500
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Spencer Baugh <sbaugh <at> catern.com>
>> Date: Sat, 14 Nov 2020 11:54:58 -0500
>> Cc: Spencer Baugh <sbaugh <at> catern.com>
>> 
>> Previously, when enabling autorevert for a new buffer, we would search
>> the buffers already registered with autorevert to see if any of them
>> had the same filename.
>> 
>> This is very slow with a large number of buffers - with 1000, it takes
>> 2 seconds on my system. This 2-second overhead is paid for every new
>> file opened.
>> 
>> But this is an unnecesary optimization; registering the same file
>> twice with file-notify has minimal or no overhead, depending on the
>> implementation.
>
> Emacs actually watches the file's directory, not the file itself.  The
> directory is what's registered with inotify and other similar
> backends.
>
>> In fact, file-notify has some baked-in overhead to support registering
>> the same file twice without problems. For example, inotify on Linux
>> returns the same inotify watch descriptor when the same file is
>> registered twice; file-notify adds an additional uniquifying id so
>> that all watch descriptors are unique in Emacs, even with inotify.
>
> Again, we watch the directory of the file, so what inotify does with
> files is not really relevant, IMO.  I wonder what that means for the
> changes you propose.

Ah. Well, the inotify comment was just an example. Even given that Emacs
watches directories rather than files, I think this change is for the
best - the overhead of registering 5 files directly instead of 1
underlying directory is minimal.




This bug report was last modified 4 years and 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.