GNU bug report logs - #56682
Fix the long lines font locking related slowdowns

Previous Next

Package: emacs;

Reported by: Gregory Heytings <gregory <at> heytings.org>

Date: Thu, 21 Jul 2022 18:01:01 UTC

Severity: normal

Done: Gregory Heytings <gregory <at> heytings.org>

Bug is archived. No further changes may be made.

Full log


Message #592 received at 56682 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: gerd.moellmann <at> gmail.com, 56682 <at> debbugs.gnu.org, larsi <at> gnus.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#56682: Fix the long lines font locking related slowdowns
Date: Mon, 01 Aug 2022 15:08:42 +0000
>
> I think we should simply unconditionally recompute the narrowing in 
> 'reseat'.  At least I couldn't think of a situation where that would 
> cause trouble, and 'reseat' is called rarely enough not to make this 
> expensive.  Am I missing something?
>

I don't think you are missing something, and that's what I suggested too. 
So there is nothing to change here, right?

>
> And another nit:
>
>  if (current_buffer->long_line_optimizations_p)
>    {
>      if (!it->narrowed_begv
> 	  || ((pos.charpos < it->narrowed_begv || pos.charpos > it->narrowed_zv)
> 	      && (!redisplaying_p || it->line_wrap == TRUNCATE)))
> 	{
> 	  it->narrowed_begv = get_narrowed_begv (it->w, window_point (it->w));
> 	  it->narrowed_zv = get_narrowed_zv (it->w, window_point (it->w));
> 	}
>    }
>
> I think this should pass pos.charpos as the 2nd argument to 
> get_narrowed_begv and get_narrowed_zv, otherwise it might not really 
> correct anything, right?  In particular, when lines are truncated, that 
> will definitely happen when we display any line but the very first.
>
> Or perhaps we should check that using window-point indeed brings 
> pos.charpos into the narrowed region, and only use pos.charpos if it 
> doesn't?
>

I changed this into:

  if (current_buffer->long_line_optimizations_p)
    {
      if (!it->narrowed_begv)
        {
          it->narrowed_begv = get_narrowed_begv (it->w, window_point (it->w));
          it->narrowed_zv = get_narrowed_zv (it->w, window_point (it->w));
        }
      else if ((pos.charpos < it->narrowed_begv || pos.charpos > it->narrowed_zv)
                && (!redisplaying_p || it->line_wrap == TRUNCATE))
        {
          it->narrowed_begv = get_narrowed_begv (it->w, pos.charpos);
          it->narrowed_zv = get_narrowed_zv (it->w, pos.charpos);
        }
    }

which seems better indeed.  Is that okay from your point of view?




This bug report was last modified 2 years and 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.