unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Aaron Jensen <aaronjensen@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>, 24048@debbugs.gnu.org
Subject: bug#24048: 25.0.95; syntax-ppss can be slow
Date: Fri, 30 Mar 2018 06:09:45 -0700	[thread overview]
Message-ID: <CAHyO48xKhjqvqNgEy6fTTNyh0yDjAvhf7KtZ9DDNzr9U_J=DKQ@mail.gmail.com> (raw)
In-Reply-To: <CAHyO48xeXB3uQg95xwYcCNm57iA2XJ1jYRwE9o63FQ_W90BQAw@mail.gmail.com>

On Mon, Jul 25, 2016 at 8:08 AM, Aaron Jensen <aaronjensen@gmail.com> wrote:
> On Mon, Jul 25, 2016 at 5:42 AM Dmitry Gutov <dgutov@yandex.ru> wrote:
>>
>> Is 5.6ms really significant? You should be typing like 200 characters
>> per _second_ to really notice the difference.
>>
>> Even 12ms that I'm getting at the bottom of your example file doesn't
>> sound like it should have effect on the perceptible latency.
>
> Even if one can’t feel 5.6ms, it becomes another brick in the bag, i.e. if another minor mode did something similar and added another 5.6ms. With enough of them most people could probably feel it.

Hey all, I'm trying to clean up bugs I've submitted. This one is still
an issue of sorts. I've fixed the downstream usage of syntax-ppss by
memoizing it, but that feels like it should be unnecessary given that
syntax-ppss is meant to do its own caching.

The problem here is that syntax-ppss will not update its cache if it
is "close enough" to the old position. In languages like Elixir (and
probably Ruby) the old position is often the beginning of the outer
module which spans most, if not all of the file. This means that the
further you get down the file, the further you get from the old
position and the more work syntax-ppss must do.

If a user of syntax-ppss is not careful (as was the case in
smartparens) then syntax-ppss can be called multiple times in
succession, which can add up to enough latency to be noticed.

Ultimately, it seems like it may be worth reconsidering this condition:

(and old-pos (< (- pos old-pos)
    ;; The time to use syntax-begin-function and
    ;; find PPSS is assumed to be about 2 * distance.
    (* 2 (/ (cdr (aref syntax-ppss-stats 5))
    (1+ (car (aref syntax-ppss-stats 5)))))))

But I do not know what other impacts that may have.

Does anybody have any new thoughts on this?

Thanks!





  reply	other threads:[~2018-03-30 13:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21 14:29 bug#24048: 25.0.95; syntax-ppss can be slow Aaron Jensen
2016-07-25  1:16 ` Dmitry Gutov
2016-07-25  7:12   ` Aaron Jensen
2016-07-25 12:42     ` Dmitry Gutov
2016-07-25 15:08       ` Aaron Jensen
2018-03-30 13:09         ` Aaron Jensen [this message]
2021-12-01 19:47           ` Lars Ingebrigtsen
2021-12-03  2:38             ` Aaron Jensen
2021-12-03 16:26               ` Lars Ingebrigtsen
2021-12-03 17:01 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-04  1:31   ` Aaron Jensen
2021-12-04  2:41     ` Lars Ingebrigtsen
2021-12-04 14:40     ` Dmitry Gutov
2021-12-04 16:27       ` Aaron Jensen
2021-12-05  0:13         ` Dmitry Gutov
2021-12-05  5:06           ` Aaron Jensen

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='CAHyO48xKhjqvqNgEy6fTTNyh0yDjAvhf7KtZ9DDNzr9U_J=DKQ@mail.gmail.com' \
    --to=aaronjensen@gmail.com \
    --cc=24048@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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).