GNU bug report logs - #44610
27.1; Keyboard Macro Performance Problem

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Robert Thorpe <rt@HIDDEN>; dated Fri, 13 Nov 2020 02:52:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 44610 <at> debbugs.gnu.org:


Received: (at 44610) by debbugs.gnu.org; 14 Nov 2020 16:50:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 14 11:50:53 2020
Received: from localhost ([127.0.0.1]:51829 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kdylJ-0001gu-34
	for submit <at> debbugs.gnu.org; Sat, 14 Nov 2020 11:50:53 -0500
Received: from eggs.gnu.org ([209.51.188.92]:47714)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kdylH-0001gi-Ra
 for 44610 <at> debbugs.gnu.org; Sat, 14 Nov 2020 11:50:52 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:57423)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kdylB-0008Qg-SC; Sat, 14 Nov 2020 11:50:45 -0500
Received: from [176.228.60.248] (port=2912 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kdylB-0007ik-86; Sat, 14 Nov 2020 11:50:45 -0500
Date: Sat, 14 Nov 2020 18:50:33 +0200
Message-Id: <838sb3vq5i.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jean Louis <bugs@HIDDEN>
In-Reply-To: <X6//v5qJKhJEH7ln@HIDDEN> (message from Jean Louis
 on Sat, 14 Nov 2020 19:03:11 +0300)
Subject: Re: bug#44610: 27.1; Keyboard Macro Performance Problem
References: <87d00irmu7.fsf@HIDDEN>
 <83pn4gui95.fsf@HIDDEN> <X6//v5qJKhJEH7ln@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44610
Cc: rt@HIDDEN, 44610 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sat, 14 Nov 2020 19:03:11 +0300
> From: Jean Louis <bugs@HIDDEN>
> Cc: Robert Thorpe <rt@HIDDEN>,
>   44610 <at> debbugs.gnu.org
> 
> I am not the initial reporter. I have tested it in python-mode in
> plain emacs -Q with the latest development version:
> 
> - command-execute                                          20,601,881  99%
>  - call-interactively                                      20,601,881  99%

Btw, did you activate the cpu profiler or the memory profiler?  It
looks like it was the latter, in which case the percents might be
skewed, as the frequency of probing the program counter is not
constant.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#44610; Package emacs. Full text available.

Message received at 44610 <at> debbugs.gnu.org:


Received: (at 44610) by debbugs.gnu.org; 14 Nov 2020 16:25:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 14 11:25:10 2020
Received: from localhost ([127.0.0.1]:51737 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kdyMQ-0007Iu-0B
	for submit <at> debbugs.gnu.org; Sat, 14 Nov 2020 11:25:10 -0500
Received: from eggs.gnu.org ([209.51.188.92]:42336)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kdyMN-0007IV-D3
 for 44610 <at> debbugs.gnu.org; Sat, 14 Nov 2020 11:25:08 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:57014)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kdyMH-0007Lp-G6; Sat, 14 Nov 2020 11:25:01 -0500
Received: from [176.228.60.248] (port=1326 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kdyMG-0003Xz-Rt; Sat, 14 Nov 2020 11:25:01 -0500
Date: Sat, 14 Nov 2020 18:24:48 +0200
Message-Id: <83a6vjvrcf.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jean Louis <bugs@HIDDEN>
In-Reply-To: <X6//v5qJKhJEH7ln@HIDDEN> (message from Jean Louis
 on Sat, 14 Nov 2020 19:03:11 +0300)
Subject: Re: bug#44610: 27.1; Keyboard Macro Performance Problem
References: <87d00irmu7.fsf@HIDDEN>
 <83pn4gui95.fsf@HIDDEN> <X6//v5qJKhJEH7ln@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44610
Cc: rt@HIDDEN, 44610 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sat, 14 Nov 2020 19:03:11 +0300
> From: Jean Louis <bugs@HIDDEN>
> Cc: Robert Thorpe <rt@HIDDEN>,
>   44610 <at> debbugs.gnu.org
> 
> I am not the initial reporter. I have tested it in python-mode in
> plain emacs -Q with the latest development version:
> 
> - command-execute                                          20,601,881  99%
>  - call-interactively                                      20,601,881  99%
>   - funcall-interactively                                  19,934,160  96%
>    - kmacro-end-or-call-macro                              15,337,767  74%
>     - kmacro-call-macro                                    15,337,767  74%
>      - call-last-kbd-macro                                 15,242,727  73%
>       - command-execute                                    15,102,838  73%
>        - call-interactively                                15,021,006  72%
>         - funcall-interactively                            14,985,294  72%
>          - next-line                                       13,970,433  67%
>           - line-move                                      13,968,321  67%
>            - line-move-visual                              12,842,225  62%
>             - vertical-motion                               9,925,619  48%
>              - jit-lock-function                            9,925,619  48%
>               - jit-lock-fontify-now                        9,925,619  48%
>                - jit-lock--run-functions                    7,165,300  34%
>                 - run-hook-wrapped                          7,157,012  34%
>                  - #<compiled 0x5b100c193163db5>            7,157,012  34%
>                   - font-lock-fontify-region                7,157,012  34%
>                    - font-lock-default-fontify-region       7,153,844  34%
>                     - font-lock-fontify-keywords-region     5,169,903  25%

Thanks, this seems to indicate that the mode's fontifications take the
lion's share of the time.  Which explains why Fundamental mode doesn't
suffer from this problem.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#44610; Package emacs. Full text available.

Message received at 44610 <at> debbugs.gnu.org:


Received: (at 44610) by debbugs.gnu.org; 14 Nov 2020 16:04:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 14 11:04:11 2020
Received: from localhost ([127.0.0.1]:51659 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kdy26-0004dG-UH
	for submit <at> debbugs.gnu.org; Sat, 14 Nov 2020 11:04:11 -0500
Received: from static.rcdrun.com ([95.85.24.50]:51747)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bugs@HIDDEN>) id 1kdy25-0004d7-J9
 for 44610 <at> debbugs.gnu.org; Sat, 14 Nov 2020 11:04:10 -0500
Received: from localhost ([::ffff:41.202.241.56])
 (AUTH: PLAIN admin, TLS: TLS1.2,256bits,ECDHE_RSA_AES_256_GCM_SHA384)
 by static.rcdrun.com with ESMTPSA
 id 00000000002C0004.000000005FAFFFF4.00000173; Sat, 14 Nov 2020 16:04:01 +0000
Date: Sat, 14 Nov 2020 19:03:11 +0300
From: Jean Louis <bugs@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#44610: 27.1; Keyboard Macro Performance Problem
Message-ID: <X6//v5qJKhJEH7ln@HIDDEN>
References: <87d00irmu7.fsf@HIDDEN>
 <83pn4gui95.fsf@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
In-Reply-To: <83pn4gui95.fsf@HIDDEN>
User-Agent: Mutt/2.0 (3d08634) (2020-11-07)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 44610
Cc: Robert Thorpe <rt@HIDDEN>, 44610 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* Eli Zaretskii <eliz@HIDDEN> [2020-11-14 17:27]:
> > From: Robert Thorpe <rt@HIDDEN>
> > 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.

That is great advise to learn from. Macro took just about less than 2
seconds on my notebook Lenovo Thinkpad T410.

I am not the initial reporter. I have tested it in python-mode in
plain emacs -Q with the latest development version:

- command-execute                                          20,601,881  99%
 - call-interactively                                      20,601,881  99%
  - funcall-interactively                                  19,934,160  96%
   - kmacro-end-or-call-macro                              15,337,767  74%
    - kmacro-call-macro                                    15,337,767  74%
     - call-last-kbd-macro                                 15,242,727  73%
      - command-execute                                    15,102,838  73%
       - call-interactively                                15,021,006  72%
        - funcall-interactively                            14,985,294  72%
         - next-line                                       13,970,433  67%
          - line-move                                      13,968,321  67%
           - line-move-visual                              12,842,225  62%
            - vertical-motion                               9,925,619  48%
             - jit-lock-function                            9,925,619  48%
              - jit-lock-fontify-now                        9,925,619  48%
               - jit-lock--run-functions                    7,165,300  34%
                - run-hook-wrapped                          7,157,012  34%
                 - #<compiled 0x5b100c193163db5>            7,157,012  34%
                  - font-lock-fontify-region                7,157,012  34%
                   - font-lock-default-fontify-region       7,153,844  34%
                    - font-lock-fontify-keywords-region     5,169,903  25%
                       #<compiled 0x19a45f465d8aaf17>         369,664   1%
                       #<compiled -0x1210e8980f7ecafc>        308,861   1%
                     - python--font-lock-f-strings            306,448   1%
                        syntax-ppss                            11,536   0%
                    - font-lock-fontify-syntactically-region     1,975,653   9%
                     - python-font-lock-syntactic-face-function     1,889,981   9%
                      - python-info-docstring-p             1,878,263   9%
                       - python-nav-backward-sexp           1,150,110   5%
                        - python-nav-forward-sexp           1,144,830   5%
                         - python-nav--forward-sexp         1,144,830   5%
                          - python-info-beginning-of-block-p       519,389   2%
                           - python-info-statement-starts-block-p       407,940   1%
                            - python-nav-beginning-of-statement       100,032   0%
                             - syntax-ppss                     46,400   0%
                                #<compiled 0x1c65d0f034163548>         4,320   0%
                             - python-info-line-ends-backslash-p        45,344   0%
                              - syntax-ppss                    45,344   0%
                                 #<compiled 0x1c65d0f034163548>         4,320   0%
                           - python-info-beginning-of-statement-p       103,161   0%
                            - python-nav-beginning-of-statement       103,161   0%
                             - syntax-ppss                     54,825   0%
                                make-byte-code                  4,377   0%
                             - python-info-line-ends-backslash-p        35,904   0%
                                syntax-ppss                    35,904   0%
                          - python-info-current-line-empty-p       307,473   1%
                             beginning-of-line                  4,377   0%
                          - python-info-end-of-block-p        130,384   0%
                           - python-info-end-of-statement-p       130,384   0%
                            - python-nav-end-of-statement       130,384   0%
                               syntax-ppss                     91,472   0%
                             - python-info-line-ends-backslash-p        34,768   0%
                                syntax-ppss                    34,768   0%
                          - python-info-beginning-of-statement-p       116,336   0%
                           - python-nav-beginning-of-statement       116,336   0%
                            - python-info-line-ends-backslash-p        55,648   0%
                               syntax-ppss                     55,648   0%
                              syntax-ppss                      44,112   0%
                          - python-nav-beginning-of-statement        53,456   0%
                           - python-info-line-ends-backslash-p        21,040   0%
                              syntax-ppss                      21,040   0%
                             syntax-ppss                       19,984   0%
                          - python-syntax-context-type          9,504   0%
                             syntax-ppss                        9,504   0%
                       - python-info-assignment-statement-p       314,499   1%
                        - python-nav-beginning-of-statement        19,587   0%
                         - python-info-line-ends-backslash-p         7,392   0%
                            syntax-ppss                         7,392   0%
                           syntax-ppss                          6,336   0%
                       - python-nav-beginning-of-statement        36,902   0%
                        - syntax-ppss                          22,595   0%
                           #<compiled 0x1c65d0f034163548>         5,859   0%
                        - python-info-line-ends-backslash-p         8,448   0%
                           syntax-ppss                          8,448   0%
                       syntax-ppss                             27,216   0%
                       replace-regexp-in-string                 2,112   0%
                      font-lock-unfontify-region                4,144   0%
               - run-with-timer                             2,730,692  13%
                - apply                                     2,730,692  13%
                 - run-at-time                              2,729,636  13%
                  - timer-activate                          2,717,252  13%
                   - timer--activate                        2,716,196  13%
                    - timer--time-less-p                    2,716,196  13%
                       timer--time                             36,054   0%
                       time-less-p                             24,036   0%
                  - timer-set-time                             12,384   0%
                     timer--time-setter                        12,384   0%
                 make-byte-code                                 5,859   0%
            - posn-at-point                                 2,878,318  13%
               file-remote-p                                2,360,868  11%
             - jit-lock-function                              340,326   1%
              - jit-lock-fontify-now                          340,326   1%
               - jit-lock--run-functions                      335,086   1%
                - run-hook-wrapped                            330,942   1%
                 - #<compiled 0x5b100c193163db5>              330,942   1%
                  - font-lock-fontify-region                  330,942   1%
                   - font-lock-default-fontify-region         329,886   1%
                    - font-lock-fontify-keywords-region       202,469   0%
                       #<compiled 0x19a45f465d8aaf17>          15,872   0%
                     - python--font-lock-f-strings             15,456   0%
                        syntax-ppss                             3,168   0%
                       #<compiled -0x1210e8980f7ecafc>         12,288   0%
                    - font-lock-fontify-syntactically-region       123,273   0%
                     - python-font-lock-syntactic-face-function        99,145   0%
                      - python-info-docstring-p                99,145   0%
                       - python-nav-backward-sexp              49,329   0%
                        - python-nav-forward-sexp              48,273   0%
                         - python-nav--forward-sexp            48,273   0%
                          - python-info-beginning-of-block-p        15,105   0%
                             python-info-statement-starts-block-p        15,105   0%
                          - python-nav-beginning-of-statement        12,512   0%
                             syntax-ppss                        8,368   0%
                            python-info-current-line-empty-p        12,288   0%
                          - python-syntax-context-type          4,224   0%
                             syntax-ppss                        4,224   0%
                          - python-info-beginning-of-statement-p         4,144   0%
                             python-nav-beginning-of-statement         4,144   0%
                       - python-info-assignment-statement-p        20,784   0%
                        - python-nav-beginning-of-statement         8,368   0%
                         - python-info-line-ends-backslash-p         3,168   0%
                            syntax-ppss                         3,168   0%
                           syntax-ppss                          1,056   0%
                       - python-nav-beginning-of-statement         8,368   0%
                          syntax-ppss                           2,112   0%
                        - python-info-line-ends-backslash-p         2,112   0%
                           syntax-ppss                          2,112   0%
                       syntax-ppss                              8,368   0%
                       replace-regexp-in-string                 4,144   0%
                      font-lock-unfontify-region                4,144   0%
             - eval                                           144,979   0%
                if                                            132,784   0%
                unless                                          6,336   0%
           - default-line-height                            1,089,216   5%
              default-font-height                           1,089,216   5%
           - window-inside-pixel-edges                         21,120   0%
            - window-edges                                     15,840   0%
               window-current-scroll-bars                      11,616   0%
         - kill-line                                          498,749   2%
          - kill-region                                       498,749   2%
           - kill-new                                         424,312   2%
              menu-bar-update-yank-menu                       340,984   1%
            - gui-select-text                                  74,880   0%
             - gui-set-selection                               74,880   0%
              - gui-backend-set-selection                      73,824   0%
               - apply                                         73,824   0%
                  #<compiled -0x1ef4cefd5124968d>              73,824   0%
           - filter-buffer-substring                           74,437   0%
            - buffer-substring--filter                         68,101   0%
             - #<compiled -0x1e2a987f6542516b>                 68,101   0%
              - apply                                          68,101   0%
               - #<compiled 0xd88b599ee0a5190>                 63,957   0%
                - delete-and-extract-region                    21,901   0%
                 - jit-lock-after-change                        9,666   0%
                  - run-hook-with-args                          4,833   0%
                   - font-lock-extend-jit-lock-region-after-change         4,833   0%
                      get-text-property                         4,833   0%
         - self-insert-command                                485,032   2%
          - python-indent-post-self-insert-function           421,304   2%
           - syntax-ppss                                      421,304   2%
            - syntax-propertize                               325,688   1%
               #<compiled 0x14be23ea75627c25>                 311,064   1%
             - run-hook-wrapped                                 1,056   0%
                #<compiled -0x10385ae61af9e5a6>                 1,056   0%
          - electric-indent-post-self-insert-function          22,016   0%
           - syntax-ppss                                       22,016   0%
            - syntax-propertize                                 3,168   0%
             - run-hook-wrapped                                 1,056   0%
                #<compiled -0x1038556930f9e5a6>                 1,056   0%
          - jit-lock-after-change                              12,432   0%
             run-hook-with-args                                 4,144   0%
          - undo-auto--undoable-change                             32   0%
           - undo-auto--boundary-ensure-timer                      32   0%
            - run-at-time                                          32   0%
             - timer-set-time                                      32   0%
                timer--time-setter                                 32   0%
      - jit-lock--antiblink-post-command                      113,809   0%
       - syntax-ppss                                           79,729   0%
          vconcat                                               4,833   0%
          syntax-propertize                                     2,112   0%
       - run-with-idle-timer                                   29,936   0%
        - timer-activate-when-idle                             25,712   0%
         - timer--activate                                     25,712   0%
            timer--time-less-p                                 25,712   0%
        - timer-set-idle-time                                   4,224   0%
           timer--time-setter                                   4,224   0%
      - undo-auto--add-boundary                                 4,224   0%
         undo-auto--boundaries                                  4,224   0%
   - execute-extended-command                               4,593,217  22%
    - command-execute                                       3,494,291  16%
     - call-interactively                                   3,494,291  16%
      - funcall-interactively                               3,494,275  16%
       - profiler-report                                    3,491,303  16%
          profiler-memory-running-p                             5,863   0%
       - profiler-start                                         2,972   0%
          message                                               2,341   0%
    - sit-for                                                 745,896   3%
     - redisplay                                              744,768   3%
      - redisplay_internal (C function)                       277,761   1%
       - tool-bar-make-keymap                                 271,923   1%
        - tool-bar-make-keymap-1                              271,923   1%
         - mapcar                                             271,923   1%
          - #<compiled -0xe8295ef54b23da6>                    271,923   1%
           - eval                                              17,416   0%
            - find-image                                       17,416   0%
               image-search-load-path                          17,416   0%
       - find-image                                             1,048   0%
          image-search-load-path                                1,048   0%
         kill-this-buffer-enabled-p                             1,024   0%
       - menu-bar-update-buffers                                  672   0%
          menu-bar-update-buffers-1                               672   0%
       - substitute-command-keys                                   21   0%
          generate-new-buffer                                      21   0%
     - read-event                                                  16   0%
      - command-execute                                            16   0%
         call-interactively                                        16   0%
    - execute-extended-command--shorter                       195,259   0%
     - completion-try-completion                              187,931   0%
      - completion--nth-completion                            186,883   0%
       - completion--some                                     186,883   0%
        - #<compiled 0x81c0cf17cf07668>                       185,827   0%
         - completion-pcm-try-completion                      184,779   0%
          - completion-pcm--merge-try                         148,675   0%
           - completion-pcm--merge-completions                 23,355   0%
              string-match                                      2,099   0%
              completion-pcm--pattern->regex                    2,096   0%
             completion-pcm--pattern->string                    1,048   0%
          - completion-pcm--find-all-completions               35,048   0%
           - completion-pcm--all-completions                   20,568   0%
              completion-pcm--pattern->regex                    1,048   0%
             completion-pcm--optimize-pattern                   1,056   0%
             completion-pcm--string->pattern                    1,024   0%
     - execute-extended-command--shorter-1                      7,328   0%
      - execute-extended-command--shorter-1                     5,232   0%
       - execute-extended-command--shorter-1                    2,096   0%
        - execute-extended-command--shorter-1                   2,096   0%
           mapcar                                               1,048   0%
         - execute-extended-command--shorter-1                  1,048   0%
          - execute-extended-command--shorter-1                 1,048   0%
             mapcar                                             1,048   0%
        mapcar                                                  1,048   0%
      commandp                                                  5,863   0%
      #<compiled -0x1910b770d84f49d5>                              42   0%
   - handle-focus-in                                            2,112   0%
    - #<compiled 0x189e2a0a0dde442>                             2,112   0%
     - apply                                                    2,112   0%
      - blink-cursor--rescan-frames                             2,112   0%
       - blink-cursor-check                                     2,112   0%
        - blink-cursor--should-blink                            2,112   0%
           frame-focus-state                                    2,112   0%
   - digit-argument                                             1,064   0%
    - universal-argument--mode                                  1,064   0%
       set-transient-map                                        1,064   0%
  - byte-code                                                 667,721   3%
   - read-extended-command                                    667,721   3%
    - completing-read                                         667,721   3%
     - completing-read-default                                667,721   3%
      - read-from-minibuffer                                  663,459   3%
       - redisplay_internal (C function)                      208,291   1%
        - tool-bar-make-keymap                                206,571   1%
         - tool-bar-make-keymap-1                             206,571   1%
          - mapcar                                            206,571   1%
           - #<compiled -0xe8295ef54b23da6>                   206,571   1%
            - eval                                              1,048   0%
             - find-image                                       1,048   0%
                image-search-load-path                          1,048   0%
        - find-image                                            1,048   0%
           image-search-load-path                               1,048   0%
        - menu-bar-update-buffers                                 672   0%
           menu-bar-update-buffers-1                              672   0%
       - command-execute                                        1,320   0%
        - call-interactively                                    1,320   0%
         - funcall-interactively                                1,080   0%
          - self-insert-command                                 1,080   0%
             #<compiled 0x23be74412ab8ae>                       1,048   0%
           - undo-auto--undoable-change                            32   0%
            - undo-auto--boundary-ensure-timer                     32   0%
             - run-at-time                                         32   0%
              - timer-set-time                                     32   0%
                 timer--time-setter                                32   0%
+ redisplay_internal (C function)                              33,424   0%
+ internal-echo-keystrokes-prefix                              15,490   0%
+ timer-event-handler                                           2,662   0%
  ...                                                               0   0%




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#44610; Package emacs. Full text available.

Message received at 44610 <at> debbugs.gnu.org:


Received: (at 44610) by debbugs.gnu.org; 14 Nov 2020 14:26:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 14 09:26:51 2020
Received: from localhost ([127.0.0.1]:50191 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kdwVv-000643-0Y
	for submit <at> debbugs.gnu.org; Sat, 14 Nov 2020 09:26:51 -0500
Received: from eggs.gnu.org ([209.51.188.92]:40882)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kdwVt-00063q-3k
 for 44610 <at> debbugs.gnu.org; Sat, 14 Nov 2020 09:26:49 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:55117)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kdwVn-000652-A2; Sat, 14 Nov 2020 09:26:43 -0500
Received: from [176.228.60.248] (port=1869 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kdwVl-00006Z-Tr; Sat, 14 Nov 2020 09:26:42 -0500
Date: Sat, 14 Nov 2020 16:26:30 +0200
Message-Id: <83pn4gui95.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Robert Thorpe <rt@HIDDEN>
In-Reply-To: <87d00irmu7.fsf@HIDDEN> (message from Robert
 Thorpe on Fri, 13 Nov 2020 02:51:12 +0000)
Subject: Re: bug#44610: 27.1; Keyboard Macro Performance Problem
References: <87d00irmu7.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44610
Cc: 44610 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Robert Thorpe <rt@HIDDEN>
> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#44610; Package emacs. Full text available.

Message received at 44610 <at> debbugs.gnu.org:


Received: (at 44610) by debbugs.gnu.org; 13 Nov 2020 08:56:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 13 03:56:04 2020
Received: from localhost ([127.0.0.1]:46624 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kdUsF-0006T9-UT
	for submit <at> debbugs.gnu.org; Fri, 13 Nov 2020 03:56:04 -0500
Received: from stw1.rcdrun.com ([217.170.207.13]:47283)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bugs@HIDDEN>) id 1kdUsC-0006Sa-Ea
 for 44610 <at> debbugs.gnu.org; Fri, 13 Nov 2020 03:56:02 -0500
Received: from [10.127.43.172] ([::ffff:41.202.241.56])
 (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_CHACHA20_POLY1305)
 by stw1.rcdrun.com with ESMTPSA
 id 000000000001E007.000000005FAE4A18.00006C8A; Fri, 13 Nov 2020 01:55:52 -0700
Date: Fri, 13 Nov 2020 08:55:45 +0000
In-Reply-To: <87d00irmu7.fsf@HIDDEN>
References: <87d00irmu7.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable
Subject: Re: bug#44610: 27.1; Keyboard Macro Performance Problem
To: Robert Thorpe <rt@HIDDEN>,
  44610 <at> debbugs.gnu.org
From: Jean Louis <bugs@HIDDEN>
Message-ID: <1A5505ED-F004-4798-8A5E-31599655045E@HIDDEN>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 44610
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Modes are programs and their checks slow down the macro execution=2E If it =
happens to me I will simple temporarily switch the mode to fundamental=2E

Maybe there is or could be an option that macro executes only in fundament=
al mode and then automatically turns on whatever other mode was there=2E


Jean




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#44610; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 13 Nov 2020 02:51:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 12 21:51:47 2020
Received: from localhost ([127.0.0.1]:46205 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kdPBi-0001XP-St
	for submit <at> debbugs.gnu.org; Thu, 12 Nov 2020 21:51:47 -0500
Received: from lists.gnu.org ([209.51.188.17]:40372)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rt@HIDDEN>) id 1kdPBe-0001XF-VA
 for submit <at> debbugs.gnu.org; Thu, 12 Nov 2020 21:51:45 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:60032)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rt@HIDDEN>)
 id 1kdPBe-00006X-Mq
 for bug-gnu-emacs@HIDDEN; Thu, 12 Nov 2020 21:51:42 -0500
Received: from outbound-smtp35.blacknight.com ([46.22.139.218]:60685)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rt@HIDDEN>)
 id 1kdPBb-0006EQ-4x
 for bug-gnu-emacs@HIDDEN; Thu, 12 Nov 2020 21:51:42 -0500
Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26])
 by outbound-smtp35.blacknight.com (Postfix) with ESMTPS id C7F40242A
 for <bug-gnu-emacs@HIDDEN>; Fri, 13 Nov 2020 02:51:34 +0000 (GMT)
Received: (qmail 4724 invoked from network); 13 Nov 2020 02:51:34 -0000
Received: from unknown (HELO rt-inspiron-3480)
 (rt@HIDDEN@[51.37.30.105])
 by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated);
 13 Nov 2020 02:51:34 -0000
From: Robert Thorpe <rt@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.1; Keyboard Macro Performance Problem
Date: Fri, 13 Nov 2020 02:51:12 +0000
Message-ID: <87d00irmu7.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=46.22.139.218;
 envelope-from=rt@HIDDEN;
 helo=outbound-smtp35.blacknight.com
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 21:51:35
X-ACL-Warn: Detected OS   = Linux 3.11 and newer [fuzzy]
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)


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.

Here is the original thread:
https://www.reddit.com/r/emacs/comments/joeno5/anyway_to_speed_up_macros_in=
_emacs/

I understand it might not be worth fixing if it's a corner case.

BR,
Robert Thorpe


In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, cair=
o version 1.17.3)
 of 2020-08-28 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description: Arch Linux

Recent messages:
Keyboard macro defined
Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %; q to quit; ? for help.
Mark set [2 times]
Saved text until "fffffffffffff (pppppppppppppppppppp);
  "
Mark set [2 times]
Defining kbd macro...
You can run the command =E2=80=98forward-line=E2=80=99 with M-x fo-lin RET
Keyboard macro defined
Can=E2=80=99t guess python-indent-offset, using defaults: 4

Configured using:
 'configure --prefix=3D/usr --sysconfdir=3D/etc --libexecdir=3D/usr/lib
 --localstatedir=3D/var --with-x-toolkit=3Dgtk3 --with-xft --with-wide-int
 --with-modules --with-cairo --with-harfbuzz 'CFLAGS=3D-march=3Dx86-64
 -mtune=3Dgeneric -O2 -pipe -fno-plt' CPPFLAGS=3D-D_FORTIFY_SOURCE=3D2
 LDFLAGS=3D-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Python

Minor modes in effect:
  shell-dirtrack-mode: t
  dynamic-completion-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow mail-extr emacsbug sendmail eieio-opt cl-extra speedbar sb-image
ezimage dframe find-func thingatpt help-fns radix-tree help-mode python
tramp-sh tramp tramp-loaddefs trampver tramp-integration files-x
tramp-compat shell pcomplete parse-time iso8601 ls-lisp comint ring
ansi-color cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs dired-aux autorevert filenotify calc-alg
calc-ext calc-menu calc calc-loaddefs calc-macs view sort disp-table
tetris gamegrid rmailsum misearch multi-isearch noutline outline
easy-mmode shr-color color shr url-cookie url-domsuf url-util url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs json map
url-vars svg xml dom browse-url qp rmailout rmailmm message rmc puny
dired-x dired dired-loaddefs format-spec rfc822 mml mml-sec
password-cache epa derived epg epg-config gnus-util time-date subr-x seq
byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode
mailabbrev gmm-utils mailheader mail-parse rfc2231 rmail rmail-loaddefs
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils bookmark
easymenu text-property-search pp server completion avoid misc edmacro
kmacro cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 212016 51202)
 (symbols 48 17470 1)
 (strings 32 53646 2929)
 (string-bytes 1 1713027)
 (vectors 16 29359)
 (vector-slots 8 1024997 53850)
 (floats 8 262 286)
 (intervals 56 13457 0)
 (buffers 1000 44))




Acknowledgement sent to Robert Thorpe <rt@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#44610; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 14 Nov 2020 17:00:02 UTC

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