Subject: Re: bug#57207: 29.0.50; Fontification is slow after e7b5912b23 (Improvements to long lines handling)

From: Gregory Heytings <[email-masked]>
Date: Mon, 22 Aug 2022 14:00:34 +0000

>
> However, resetting the narrowing in _all_ buffers at the beginning of 
> each redisplay cycle could be quite expensive in sessions with many 
> hundreds of live buffers.
>

Actually, we only reset the locked narrowing in all buffers.  An Emacs 
session would typically only have a handful of live buffers in which such 
a narrowing is used, i.e. a small fraction of the live buffers.

>
> How much time does the loop in reset_outermost_narrowings take per live 
> buffer?
>

About 150 ns/buffer here.  I'll see whether and how it could be improved.

>
> Should we perhaps maintain a list of buffers with such narrowing?  It 
> should be a very short list.
>

That's one possibility indeed.