Subject: Re: bug#38644: 26.3; emacs uses 100% CPU with auto-revert-mode

From: Peter Ludemann <[email-masked]>
Date: Mon, 6 Jan 2020 16:34:19 -0800

Correction -- the "lock-up" I observed might have been due to paging
(possibly related to emacs - I'll have to investigate later).
Toggling auto-revert-avoid-polling appeared to reduc emacs CPU usage,
according to top(1) - it's a bit difficult to tell because there seems to
be some lag in when the command takes effect and my compilation process
switches a certain amount between CPU-intensive and IO-intensive. Anyway,
CPU seemed to drop from ~60% to ~30% (please take this observation with a
large grain of salt).
I'll try more things in the future and report if anything interesting shows
up.
- peter

On Mon, 6 Jan 2020 at 16:01, Peter Ludemann <[email-masked]>
wrote:

> If anything, auto-revert-avoid-polling makes responsiveness worse -- the
> window locked up a few times on me while doing ctrl-N while running a
> CPU-intensive (and possibly IO-intensive) compilation.
> Although I might not have set the value correctly ... I did M-x
> customise-variable RET auto-revert-avoid-polling RET then "toggle" then
> "apply".
> .
>
> On Sun, 5 Jan 2020 at 11:57, Mattias Engdegård <[email-masked]> wrote:
>
>> 5 jan. 2020 kl. 20.31 skrev Peter Ludemann <[email-masked]>:
>>
>> > Which version of Emacs would you like me to try this with? And what
>> result are you expecting/hoping to see? (e.g., might it reduce the current
>> 30-80% CPU load for polling with emacs 28.0.50?) There are only a few open
>> files directly under /tmp, so would this have any effect or does it
>> propagate down to subdirectories?
>> >
>> > [Also, I'd need a few more details (not being an emacs-internals
>> person) ... should I add this to my .emacs and restart, or execute in a
>> scratch buffer, or ...?]
>>
>> 'auto-revert-avoid-polling' is a single global customisable variable, so
>> you would set it using
>>
>>  M-x customise-variable RET auto-revert-avoid-polling RET
>>
>> , then turn it on and apply the change. I believe it was introduced in
>> Emacs 27.
>>
>> The idea is to save CPU by not having to look at files periodically to
>> see if they have changed. I have no idea if you would see any improvement
>> at all, but it shouldn't make anything worse.
>>
>>