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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 15 Aug 2022 17:28:44 +0300

> From: Ihor Radchenko <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Mon, 15 Aug 2022 22:12:15 +0800
> 
> > When it hangs, can you attach a debugger to it and try to figure out
> > where it loops?  The instructions to do so are in etc/DEBUG, under "If
> > the symptom of the bug is that Emacs fails to respond".  If that
> > procedure is more than you can afford, at least post the results of
> > "thread apply all bt" after attaching the debugger to a "hung" Emacs.
> 
> Emacs with debugging support is generally slow on my large Org file, but
> I think that I managed to get some kind of backtrace with the default
> value of long-line-threshold.
> 
> I typed C-z in GDB shell right after triggering the slow operation (it
> is headline unfolding in my testing).
> 
> (I did confirm that setting long-line-threshold to nil makes the
> unfolding instant)
> 
> The GDB log is below. Hope it gives some clues.

It does, and it is the code I suspected was the culprit.

Can you tell some statistics about the lines in that file:

  . how many lines?
  . how many lines longer than 10000 characters?
  . how many lines longer than 100000 characters?

And finally, can you post a short enough Org file, but long enough to
exhibit the features you need to do the "unfolding headlines hidden
using 'invisible text property" thing?  And also tell which Org
commands you invoke to do that unfolding?  Because I don't think I
understand what exactly are you doing in Org to trigger this, and thus
I cannot try reproducing it.

Thanks.