Subject: Re: bug#56682: Fix the long lines font locking related slowdowns

From: Gregory Heytings <[email-masked]>
Date: Tue, 02 Aug 2022 21:43:35 +0000

>
> Hmmm was that using the GNU ELPA `json-mode` package?
>

No, it's with emacs -Q.

>> Sure, there are perhaps modes that are slower, but my tests seem to 
>> indicate that the 1/10 ratio is correct, or IOW that syntax-ppss is an 
>> order of magnitude slower than opening the file.
>
> You might be right.
>
> But there are still significant differences between different major 
> modes:
>
> LISP> (benchmark-run 1 (fundamental-mode) (parse-partial-sexp (point-min) (point-max)))
> (0.276774213 0 0.0)
>
> LISP> (benchmark-run 1 (fundamental-mode) (syntax-ppss (point-max)))
> (0.329234636 0 0.0)
>
> ELISP> (benchmark-run 1 (emacs-lisp-mode) (syntax-ppss (point-max)))
> (0.392759479 0 0.0)
>
> ELISP> (benchmark-run 1 (js-mode) (syntax-ppss (point-max)))
> (1.036089104 7 0.20054423700000001)
>
> ELISP> (benchmark-run 1 (nxml-mode) (syntax-ppss (point-max)))
> (1.169055192 7 0.15886504199999996)
>
> ELISP> (benchmark-run 1 (cperl-mode) (syntax-ppss (point-max)))
> (1.857638439 9 0.19724271499999996)
>
> (this was in a 5MB buffer).
>

Yes, that's correct.  (But did you test each mode with the same 5 MB 
buffer?  If so, that's perhaps not representative of what happens in 
reality.)  The general idea is that syntax-ppss is currently an order of 
magnitude too slow for "too large" buffers.