GNU bug report logs - #24048
25.0.95; syntax-ppss can be slow

Previous Next

Package: emacs;

Reported by: Aaron Jensen <aaronjensen <at> gmail.com>

Date: Thu, 21 Jul 2016 14:31:02 UTC

Severity: normal

Tags: moreinfo

Found in version 25.0.95

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #28 received at 24048 <at> debbugs.gnu.org (full text, mbox):

From: Aaron Jensen <aaronjensen <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 24048 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#24048: 25.0.95; syntax-ppss can be slow
Date: Thu, 2 Dec 2021 21:38:07 -0500
On Wed, Dec 1, 2021 at 2:47 PM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
> Aaron Jensen <aaronjensen <at> 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




This bug report was last modified 3 years and 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.