all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: lists@dima.secretsauce.net, emacs-devel@gnu.org
Subject: Re: Clarification about auto-revert-mode and inotify
Date: Wed, 22 Oct 2014 17:47:36 +0300	[thread overview]
Message-ID: <834muw9n5j.fsf@gnu.org> (raw)
In-Reply-To: <jwvh9ywol3u.fsf-monnier+emacs@gnu.org>

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: lists@dima.secretsauce.net,  emacs-devel@gnu.org
> Date: Tue, 21 Oct 2014 23:20:59 -0400
> 
> > Anyway, if 0.01 s is too expensive, you can always make it 0.2 s,
> > which is also "instantaneous" in human reaction time terms, but is 20
> > times less expensive CPU-wise.
> 
> That's better, indeed.  The other problem I see with just increasing the
> timer frequency is the effect it has on those files not covered by
> inotify (e.g. remote files).

Maybe we should have 2 separate options, then (if we are going to
reduce the default time interval).

> >> I think that with inotify support, we should be able to handle
> >> efficiently (i.e. with prompt refresh and with almost no CPU use when no
> >> files are modified) a situation where the user enabled
> >> global-auto-revert-mode with a 100 file buffers.
> > You do remember that we actually watch the directory of the file, not
> > the file itself, right?  And you do know how the inotify events are
> > processed by Emacs, right?
> 
> I have no idea why that would matter.

You are worried about scalability, and present requirements for it.
My point is that scalability is not affected only by the number of
buffers that have auto-revert turned on.  In a busy directory, we will
have to process many notifications that eventually turn out to be for
files we don't care about.  Processing each notification requires
looping through all the buffers, to find those which have auto-revert
turned on.  (We do cut short the search when we find the first client
buffer for a particular notification, but that doesn't help with
notifications for which there is no client buffer.)  So processing
notifications on a busy system might itself present scalability
problems and uses up a significant amount of CPU cycles, and I'm not
at all sure the goal of "prompt refresh and almost no CPU use" is
reachable in a way that is scalable to busy directories.

And what about the scalability of the change proposed by Dima?  It
causes each auto-reverted buffer to have its own timer, which would
mean dozens of timers running to support 100 buffers.  Wouldn't that
slow down Emacs's input loop?

And, of course, the revert operation itself also uses up CPU.  The
relatively long interval we use now in effect collapses all the
modifications to a file during the last 5 sec into a single revert.
Reverting "immediately" will revert on each notification, which could
be quite a lot.  How will that affect scalability?

In addition, the proposed way of throttling down the revert rate only
makes sense to me for files that change infrequently, because
frequently modified files will have all but the first modification
delayed.  That doesn't fit the "tail -f" use case, for example.
Sounds like the proposed change is targeting a very narrow niche of
use cases.

Bottom line, if scalability is a requirement, we need to have a
broader picture, and then consider the possible solutions based on
notifications in light of that.



  reply	other threads:[~2014-10-22 14:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21  7:00 Clarification about auto-revert-mode and inotify Dima Kogan
2014-10-21 13:43 ` Stefan Monnier
2014-10-21 15:08   ` Eli Zaretskii
2014-10-21 16:28     ` Stefan Monnier
2014-10-21 17:47       ` Eli Zaretskii
2014-10-21 20:23         ` Stefan Monnier
2014-10-21 20:32           ` Eli Zaretskii
2014-10-21 21:32             ` Stefan Monnier
2014-10-22  2:47               ` Eli Zaretskii
2014-10-22  3:20                 ` Stefan Monnier
2014-10-22 14:47                   ` Eli Zaretskii [this message]
2014-10-22 17:09                     ` Stefan Monnier
2014-10-24  7:02                       ` Dima Kogan
2014-10-21 17:59   ` Dima Kogan
2014-10-21 18:34     ` Eli Zaretskii
2014-10-21 18:59       ` Dima Kogan
2014-10-21 19:36         ` Eli Zaretskii
2014-10-21 19:39           ` Dima Kogan
2014-10-21 20:09             ` Eli Zaretskii
2014-10-21 20:29               ` Dima Kogan
2014-10-22  2:42                 ` Eli Zaretskii
2014-10-22  5:36                   ` Per Starbäck
2014-10-22 14:51                     ` Eli Zaretskii
2014-10-22 19:08                       ` Per Starbäck
2014-10-22 19:35                         ` Eli Zaretskii
2014-10-22 10:13               ` Florian Weimer
  -- strict thread matches above, loose matches on Subject: below --
2014-10-21  6:01 Dima Kogan
2014-10-21  5:03 Dima Kogan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834muw9n5j.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=lists@dima.secretsauce.net \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.