unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Aaron Jensen <aaronjensen@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 24048@debbugs.gnu.org, Dmitry Gutov <dgutov@yandex.ru>
Subject: bug#24048: 25.0.95; syntax-ppss can be slow
Date: Thu, 2 Dec 2021 21:38:07 -0500	[thread overview]
Message-ID: <CAHyO48yd0c_4mwP-boBGwW64LxrwMaXL0sncww01UvZ7iSAJNA@mail.gmail.com> (raw)
In-Reply-To: <87o860f6ov.fsf@gnus.org>

On Wed, Dec 1, 2021 at 2:47 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:
>
> Aaron Jensen <aaronjensen@gmail.com> writes:
>
> > 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)))))))
>
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
>
> This bit is now:
>
>         (if (and old-pos (< (- pos old-pos)
>                             ;; The time to use syntax-begin-function and
>                             ;; find PPSS is assumed to be about 2 * distance.
>                             (let ((pair (aref syntax-ppss-stats 5)))
>                               (/ (* 2 (cdr pair)) (car pair)))))
>
> I.e., the last clause is gone.  I don't know whether this affects the
> issue you were seeing, though.  Is syntax-ppss still mis-caching things
> for you?

I can still reproduce it with the specified repro:

Load https://gist.githubusercontent.com/aaronjensen/d4cd40347a916dd36c8239afecf64a7d/raw/b52440bb51b96193a365a7f4cc1c8733ba98476f/syntax-ppss-slow-repro.ex
Install and enable elixir-mode

At top of file:
M-: (benchmark 100 '(syntax-ppss))

On line 71:
M-: (benchmark 100 '(syntax-ppss))

For me it's 0.1ms vs 5ms

Aaron





  reply	other threads:[~2021-12-03  2:38 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
2021-12-01 19:47           ` Lars Ingebrigtsen
2021-12-03  2:38             ` Aaron Jensen [this message]
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=CAHyO48yd0c_4mwP-boBGwW64LxrwMaXL0sncww01UvZ7iSAJNA@mail.gmail.com \
    --to=aaronjensen@gmail.com \
    --cc=24048@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=larsi@gnus.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).