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

From: Gregory Heytings <[email-masked]>
Date: Thu, 04 Aug 2022 19:26:03 +0000

>
> So if composition_compute_stop_pos is the bottleneck, perhaps some 
> simple caching could help?
>

This is exactly what I tried...

>
> But note that when this function is called twice with the same character 
> position, it is called to search in different directions -- once forward 
> and another time back.
>

... but I missed that important piece of the puzzle, thanks!

>
> For now, I don't see how to speed this up, without producing woefully 
> incorrect display.  I will keep thinking, but I'm not too worried about 
> this case, since the current performance is tolerable enough, even if 
> somewhat sluggish.
>

Alas, it becomes much more sluggish if with a larger frame (160 columns 
instead of 80), and/or with only Arabic characters.  Emacs takes ~10 
seconds to open a file with only 6000 characters on a single line, and 
motion commands are slow.

>> You didn't tell me whether it's okay to merge the branch with the 
>> latest changes?
>
> I think you can merge.
>

Done.