bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35418: [PATCH] Don't poll auto-revert files that use notification


From: Mattias Engdegård
Subject: bug#35418: [PATCH] Don't poll auto-revert files that use notification
Date: Mon, 29 Apr 2019 20:29:07 +0200

29 apr. 2019 kl. 14.18 skrev Michael Albinus <address@hidden>:
> 
>> I decided to maintain it as a derived state
>> because it felt silly to replace O(1) code with O(N), and the
>> invariant is clear enough (stated in its doc string). (Some of the
>> places where the variable is updated are O(N) but less frequently
>> executed.)
> 
> Yes, but is N large enough to experience the difference?

These things are tricky to measure, but obviously inefficient code just doesn't 
feel right to write. For example, generating a list just to see if it is 
non-empty, when that could be determined in a more straightforward way.

> My proposal was to use it NOT as a predicate, but as a function
> returning the buffer list.

Very well; here is an incremental patch (to make the differences clear). It's a 
compromise: the derived state is gone, but there are two functions: one for the 
list of buffers that need to be polled, and one for whether that list would be 
non-empty.

By the way, the patch now uses functions from cl-lib, not just macros. Is there 
any reason not to?

Attachment: 0001-Eliminate-the-auto-revert-polled-buffers-variable.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]