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

From: Stephen Berman <[email-masked]>
Date: Wed, 10 Aug 2022 12:55:00 +0200

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

>>> 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".

i7-8700 CPU @ 3.20GHz with 6 cores (12 processors).  (It's somewhat
throttled due to Meltdown and Spectre mitigations.)

> 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.

Indeed, setting bidi-inhibit-bpa to t eliminates the delay.  Thanks.

Steve Berman