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

From: Gregory Heytings <[email-masked]>
Date: Fri, 05 Aug 2022 09:37:35 +0000

>
> It doesn't surprise me.  If you disable font-lock and show-paren-mode, 
> does it become significantly faster?  And how does disabling font-lock 
> that measure vs disabling auto-composition-mode with that file?
>

Disabling show-paren-mode and font-lock has no effect, no.  What is 
surprising is that the speed seems to depend both on the mode and on the 
presence of bidirectionality (so it seems that after all bidi is involved 
in one way or another).

>
> Can you post that file?  I'd like to try some ideas I might have with 
> it.
>

There are now eight files:

1. https://www.heytings.org/data/arabic-large.json
2. https://www.heytings.org/data/arabic-large.json.txt
3. https://www.heytings.org/data/arabic-large.txt
4. https://www.heytings.org/data/arabic-large.txt.json
5. https://www.heytings.org/data/arabic-small.json
6. https://www.heytings.org/data/arabic-small.json.txt
7. https://www.heytings.org/data/arabic-small.txt
8. https://www.heytings.org/data/arabic-small.txt.json

1 and 2, 3 and 4, 5 and 6, 7 and 8 are the same file, the only difference 
is the added extension.  1, 2, 3 and 4 on the one hand, and 5, 6, 7 and 8 
on the other hand, are almost the same file, the only difference is that 
in 1 and 2 and 5 and 6 the arabic text is enclosed into '{"ar":"<arabic 
text>"}'.

Now what you'll see is that 5 is slow, 6 is also slow (so it's not only 
js-mode which is doing something wrong), 7 is fast, and 8 is again slow 
(so js-mode is perhaps doing something wrong).  Also, the motion commands 
C-n and C-p do not work as expected in 5, 6 and 8.