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

From: Gregory Heytings <[email-masked]>
Date: Wed, 10 Aug 2022 10:34:32 +0000

>> That's not expected, no, and rather surprising because it would 
>> contradict what we've seen so far.  Can you post that file somewhere?
>
> It contains nothing particularly personal, so I've attached it.
>

Thanks.  A last question: what CPU does your computer use?  I do see a 
(very slight) stuttering here, certainly not "several seconds".

Anyway, this file is too small for you to see the effect/benefits of long 
line optimizations.  The cause of the delays you see is the "Bidirectional 
Parentheses Algorithm" which is used by Emacs, and which you can disable 
by setting bidi-inhibit-bpa to t.  It makes C-n and C-p an order of 
magnitude slower in that file.  On my computer and in that file, they take 
50 ms with bidi-inhibit-bpa nil and 5 ms with bidi-inhibit-bpa t.  So far 
I don't think these delays are annoying enough to disable that algorithm 
by default in files with long lines.  Another option might be to add some 
limits to the algorithm in buffers with long lines, without disabling it 
completely.