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

From: Stephen Berman <[email-masked]>
Date: Wed, 10 Aug 2022 15:04:53 +0200

On Wed, 10 Aug 2022 12:48:49 +0000 Gregory Heytings <[email-masked]> wrote:

>>>> If you remove the 3 closing braces/brackets at EOB and the corresponding
>>>> opening braces/brackets, does navigation become significantly faster?
>>>
>>> Yes, removing the 3 brackets at positions 1, 22, 23 and 19538, 19539 and
>>> 19540 solves that problem.  In fact, just removing the brackets at 1, 22
>>> and 23 solves that problem.  You can see the same problem in
>>> dictionary.json, just removing the first character makes C-n and C-p faster
>>> at BOB.
>>
>> Stephen said it had a much smaller effect than inhibiting the BPA. But yes,
>> very long bracketed text segments could be a problem.
>>
>
> I'm not completely sure he did indeed remove those three brackets. Stephen,
> can you remove the three characters at positions 1, 22 and 23, and try again?
> These are the first two '{' and the first '[' characters in the buffer.

I did remove those brackets previously; the improvement I see is that,
without them (and even without removing the corresponding closing
brackets at the end of the file, and of course with bidi-inhibit-bpa
nil), holding down `C-n' moves the cursor almost a whole screenful (~60
visual lines) before coming to a halt, instead of just three visual
lines with the initial brackets, and after letting go of `C-n', the
cursor catches up to the actual position of point noticeably quicker
than with the unaltered file.  Still, the movement is not at all smooth,
unlike with bidi-inhibit-bpa non-nil (and that is not as smooth as
moving through the same file with so-long-mode enabled).

Steve Berman