Subject: Re: bug#44610: 27.1; Keyboard Macro Performance Problem

From: Eli Zaretskii <[email-masked]>
Date: Sat, 14 Nov 2020 16:26:30 +0200

> From: Robert Thorpe <[email-masked]>
> Date: Fri, 13 Nov 2020 02:51:12 +0000
> 
> 
> This bug report comes from a discussion on Emacs reddit.
> 
> Start with a blank buffer and create about ~300 lines of the string:
> 
>   ffffffffffffffffffff (pppppppppppppppppppp);
> 
> This will be turned into:
> 
>   'ffffffffffffffffffff':
> 
> That can be done using the following keyboard macro: M-m ' M-f ' : C-k
> C-n
> 
> You can apply that to every line in the buffer using C-u 300 f4.
> 
> Now here's the strange bit.  In a fundamental-mode buffer this is
> extremely fast, nearly instantaneous.  But, in a python-mode buffer it
> takes 20 to 30 seconds.  If the mode is c-mode then it is also much
> slower than fundamental-mode.  It will also exceed the variable binding
> depth in some cases.  Oddly it is faster if you use forward-line instead
> of C-n.

I suggest to produce and present a profile of this.  Invoke this macro
after "M-x profiler-start RET RET", then "M-x profiler-report RET",
expand the profile fully by "C-u RET" on the top line, and post the
result here.  That should give some clues.