Subject: Re: bug#56682: locked narrowing

From: Gregory Heytings <[email-masked]>
Date: Wed, 30 Nov 2022 00:15:39 +0000

>> The result will be that the benchmark will report ~30ms both near BOB 
>> and near EOB. So the long-lines-threshold thingy adds a regression 
>> here.
>
> It's not a regression, it's the price we agreed to pay to detect whether 
> the buffer contains long lines.  That detection happens dynamically, to 
> catch cases when long lines are inserted in a buffer.
>

After looking at this closely, it turns out that the change in 1c837c42c2 
doesn't do what it was meant to do.  Sigh...  Dmitry, can you confirm that 
the following change fixes this?

diff --git a/src/xdisp.c b/src/xdisp.c
index b09aa6ec96..cdd6a7f5fe 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -19535,7 +19535,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
    /* Check whether the buffer to be displayed contains long lines.  */
    if (!NILP (Vlong_line_threshold)
        && !current_buffer->long_line_optimizations_p
-      && CHARS_MODIFF - CHARS_UNCHANGED_MODIFIED > 8)
+      && CHARS_MODIFF - UNCHANGED_MODIFIED > 8)
      {
        ptrdiff_t cur, next, found, max = 0, threshold;
        threshold = XFIXNUM (Vlong_line_threshold);