For the last few months, committing even tiny changes using magit (c
c
) is really slow to bring up the commit message buffer. I've profiled the code that is executing during that time but I'm not really sure what to look for. Here is a profile with the most expensive nodes expanded:
- server-process-filter 6065 53%
- funcall 6065 53%
- #<compiled 0x15b1c9f> 6065 53%
- funcall 6065 53%
- #<compiled 0x15b1cab> 6065 53%
- server-execute-continuation 6065 53%
- funcall 6065 53%
- #<compiled 0x17a837f> 6065 53%
- #<compiled 0x17a836b> 6065 53%
- server-execute 6065 53%
- funcall 6065 53%
- #<compiled 0x17a83cf> 6065 53%
- funcall 6065 53%
- #<compiled 0x17a8431> 6065 53%
- server-visit-files 6050 53%
- apply 6050 53%
- #<compiled 0x4639b1> 6050 53%
- find-file-noselect 6050 53%
- find-file-noselect-1 6047 53%
- after-find-file 6047 53%
- run-hooks 5147 45%
- git-commit-setup-check-buffer 5147 45%
- git-commit-setup 5147 45%
- git-commit-setup-font-lock 3184 28%
- regexp-opt 3153 27%
+ regexp-opt-group 2385 21%
delete-dups 756 6%
- magit-list-remote-branch-names 23 0%
+ magit-list-refnames 23 0%
- normal-mode 1963 17%
- funcall 1015 8%
+ #<compiled 0x22c05f> 1015 8%
- fundamental-mode 948 8%
+ run-mode-hooks 948 8%
+ normal-mode 900 7%
+ run-hooks 11 0%
- ... 4264 37%
Automatic GC 4239 37%
+ magit-insert-unpushed-to-upstream-or-recent 17 0%
+ company-post-command 4 0%
+ vc-backend 4 0%
+ command-execute 868 7%
+ redisplay_internal (C function) 64 0%
+ timer-event-handler 52 0%
company-quickhelp-mode-check-buffers 4 0%
+ mouse-fixup-help-message 1 0%
Any ideas?
UPDATE
I'm able to reproduce with the following minimal init.el
file:
(require 'package)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.org/packages/")))
(package-initialize)
(require 'use-package)
(use-package magit
:ensure t
:bind ("C-x g" . magit-status))
git diff
, see which changes could be the cause. – Jesse Mar 19 '18 at 17:03init.el
that I can reproduce the problem with – thehouse Mar 19 '18 at 17:46regexp-opt
seems to be taking a larger proportion than I would have expected. Do you have a lot of branches? Looking at the source I see(regexp-opt (magit-list-local-branch-names))
and(regexp-opt (magit-list-remote-branch-names))
. – npostavs Mar 20 '18 at 2:25