When editing a Python/Django models.py file for a very large database, I was reformatting the database fields to be used elsewhere in the project. So I used a macro to edit 330 lines to change the format from:
and executing it for 329 more iterations takes 31.96 and 29.19 seconds! When executing a similar macro, but instead of C-n, I was using "M-x forward-line" to go to the next line, it only took 8.66 and 8.86 seconds. Another similar macro, but without the C-n and then executing the macro over the highlighted region with C-x C-k r (for apply-macro-to-region-lines), it only takes 5.83 and 5.79 seconds!
I have run several tests in emacs over the last several days and have gotten predictable results. The above timed tests were always performed in a "fresh" instance, started with "$ emacs -Q" and I had always rebooted emacs in between test times to ensure nothing was cached. I am only displaying the results of 4 tests above, but I have tested this SEVERAL times in many different configurations. I have also tested this on Emacs 26.1 from the Debian Stable repos and get the exact same results. I initially sought out help and tips on reddit, and other users have tried running the macro on their machines and had similar results. It was from other users' input that we discovered that "M-x fo-lin" and "C-x C-k r" give us macro execution times that are reasonable and comparable to vim (which only takes 3.26 seconds for the equivalent macro).
In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.16.0) of 2020-11-07, modified by Debian built on x86-ubc-01 Windowing system distributor 'The X.Org Foundation', version 11.0.12009000 System Description: Debian GNU/Linux bullseye/sid
Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a.
Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t