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

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 08 Dec 2022 10:07:01 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
57207: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57207
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#57207: 29.0.50; Fontification is slow after e7b5912b23 (Improvements to long lines handling)
From: Gregory Heytings <[email-masked]>
To: [email-masked]
Cc: Ihor Radchenko <[email-masked]>
Date: Thu, 08 Dec 2022 10:05:58 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Ihor confirmed (privately) that this bug is fixed.  Closing.

Subject: 29.0.50; Fontification is slow after e7b5912b23 (Improvements to long lines handling)
From: Ihor Radchenko <[email-masked]>
To: [email-masked]
Date: Sun, 14 Aug 2022 23:55:46 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

I am experiencing severe performance degradation on current master.

The degradation happens when working with Org files and I managed to
bisect the cause down to

e7b5912b235936b304701ba6b1e808d9b197fd4f is the first bad commit
commit e7b5912b235936b304701ba6b1e808d9b197fd4f
Author: Gregory Heytings <[email-masked]>
Date:   Sat Jul 16 19:06:38 2022 +0000

    Improvements to long lines handling.
    
    * src/buffer.h (struct buffer): New field 'long_line_optimizations_p'.
    
    * src/buffer.c (syms_of_buffer): New variable 'long-line-threshold'.
    (reset_buffer): Initialize the 'long_line_optimizations_p' field.
    (Fbuffer_swap_text): Handle it.
...

I tried M-x profiler to find the cause, but the 3-4 second hangs are not
reflected in the profiler report.

debug-on-entry + manual stepping through the function revealed that the
hang happens when calling jit-lock-fontify-now.

I was able to trigger the slowdown when unfolding headlines hidden using
'invisible text property.

Do you have any idea what could be going wrong or how to debug things further?

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92