unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] 5x speedup of flyspell-buffer
Date: Thu, 13 Apr 2023 13:29:33 -0700	[thread overview]
Message-ID: <ZDhmLUyRLtKmF5ug@login.math.berkeley.edu> (raw)
In-Reply-To: <83wn2g3wes.fsf@gnu.org>

On Thu, Apr 13, 2023 at 01:32:11PM +0300, Eli Zaretskii wrote:
> > Without profiling, how to find out “how much overhead is tolerable to
> > the user”?!
> 
> Since you say the change you propose speeds up by a factor of 5, just
> setting N = 5 should do approximately the same, no?  I'd actually go
> with N = 10 for a good measure.

Nope.  My solution decreases THE OVERHEAD 50 times.  This SPEEDS UP
the whole brouhaha ∼5x (since the overhead was 4x). 

> > Going logarithmic avoids all these complications.
> 
> But, as you say, the 1.05 factor was chosen by some kind of profiling
> as well, no?

Sure — but the logarithmic solution is not sensitive to the
system/operator’s specifics. 

> > P.S.  BTW, there is very little need to lock the UI.  On my (very old
> >       and slow) system, these 10,000 misspellings are reported in 300ms
> >       (even though aspell is cygwin — read “slow” — one).  After this
> >       list of misspellings is swallowed, the rest of marking can be
> >       done asynchronously, via timers.
> 
> If you intend to do this asynchronously, I think a relevant question
> is why would you need to do that for the entire buffer?  When doing
> this synchronously, the answer is clear, but doing it asynchronously
> means you don't really care when will it end.  So in that case,
> perhaps a better idea would be to spell-check only the stuff in the
> window, and update that as the window is scrolled to expose more of
> the text, like jit-lock.el does for fontifications?

The simple answer: this does not work.

Observe “how well implemented” it is now — after decades of many
people trying!  (I have seen something like tens of discussions of
people attempting something like this.  The latest attempt I have seen
uses POLLING!)

Ilya

P.S.  This seems (probably) very similar to jit-lock vs lazy-lock.  In my
      experiments, jit-lock is/was “an order of magnitude worse”.  (Do
      not remember the details)

      So I need to do through a lot of fracas to upgrade to each new
      version of Emacs…

P.P.S.  On my system, the minimal overhead of flyspell-large-region (for
	small regions) is ~0.6sec.  Not suitable for every update of a
	buffer.

	(This is ON TOP of “other problems of implementation”.)



  reply	other threads:[~2023-04-13 20:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 13:50 [PATCH] 5x speedup of flyspell-buffer Ilya Zakharevich
2023-04-13  6:54 ` Eli Zaretskii
2023-04-13 10:23   ` Ilya Zakharevich
2023-04-13 10:32     ` Eli Zaretskii
2023-04-13 20:29       ` Ilya Zakharevich [this message]
2023-04-14  5:47         ` Eli Zaretskii
2023-04-14  6:39           ` Dr. Arne Babenhauserheide
2023-04-14  6:54             ` Eli Zaretskii
2023-04-15  1:51     ` interacting during (sit-for 0). Was: " Ilya Zakharevich
2023-04-15  2:01       ` Ilya Zakharevich

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=ZDhmLUyRLtKmF5ug@login.math.berkeley.edu \
    --to=nospam-abuse@ilyaz.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).