This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-22
Channels
- # announcements (88)
- # autochrome-github (2)
- # babashka (26)
- # beginners (5)
- # biff (2)
- # cider (73)
- # clj-kondo (4)
- # cljsrn (6)
- # clojure (54)
- # clojure-art (3)
- # clojure-europe (73)
- # clojure-germany (5)
- # clojure-new-zealand (1)
- # clojure-nl (13)
- # clojure-norway (16)
- # clojure-uk (8)
- # clojurescript (73)
- # conjure (1)
- # core-async (10)
- # cursive (17)
- # datahike (51)
- # datalevin (21)
- # datomic (4)
- # emacs (2)
- # events (3)
- # fulcro (35)
- # honeysql (6)
- # introduce-yourself (1)
- # jackdaw (3)
- # jobs (1)
- # leiningen (4)
- # lsp (3)
- # malli (17)
- # off-topic (60)
- # other-languages (5)
- # pathom (17)
- # pedestal (3)
- # polylith (19)
- # portal (2)
- # practicalli (1)
- # rdf (14)
- # reitit (3)
- # releases (1)
- # reveal (9)
- # sci (1)
- # shadow-cljs (26)
- # spacemacs (17)
- # sql (4)
- # testing (10)
- # tools-build (6)
- # tools-deps (16)
- # vim (9)
I've been quite annoyed by magit's slowness in the past few months.
I'm not sure when it started happening but I typically have to wait about 5 seconds for things like magit-status or even commit.
It definitely used to be much faster (perhaps 2 seconds, but not 5+)
As an experiment, I changed magit-diff-refine-hunk
variable to t
(selected) and then to never
- it's perhaps a bit faster but still slow.
Here's the cpu profile I tried to capture:
- magit-status-refresh-buffer 449 55%
- magit-run-section-hook 433 53%
- apply 433 53%
+ magit-insert-status-headers 129 16%
+ magit-insert-unpushed-to-pushremote 78 9%
+ magit-insert-stashes 69 8%
+ magit-insert-unpushed-to-upstream-or-recent 36 4%
+ magit-insert-staged-changes 26 3%
+ magit-insert-untracked-files 25 3%
+ magit-insert-unstaged-changes 24 2%
+ forge-insert-pullreqs 17 2%
+ magit-insert-unpulled-from-pushremote 12 1%
+ magit-insert-merge-log 11 1%
+ magit-insert-rebase-sequence 1 0%
+ magit-insert-sequencer-sequence 1 0%
+ magit-insert-bisect-log 1 0%
Even just stashing changes takes at least 2 seconds.
Commit takes at least 3 seconds (even with magit-diff-refine-hunk
set to never
)
I haven't noticed any speed problems in general. There are some slow cases when committing changes in a large JSON file • figwheel-main build for GitHub pages • really long config file for VSpaceCode I assume this slow down is due to font locking the diffs. I can run the profiler next time I use magit and share the numbers I get
No noticeable slowdown except for the JSON cases mentioned before. The only time I recall magit being slow was when Spacemacs included Magithub, but that seems like a long time ago. magit forge doesn't seem to affect performance, although downloading issues can take a second or so when manually invoking an issue update I think I have these variables set https://practical.li/spacemacs/source-control/forge-configuration.html#configure-the-number-of-open-and-closed-topics-shown-in-forge
Ok, thanks. When you say "no noticable slowdown" what does that mean? Does status, stash, commit and similar operations complete within a second? two seconds? more?
Btw. it's somewhat faster after I upgraded emacs (just tiny version upgrade) and all the packages.
I also kept magit-diff-refine-hunk
var set to t
(selected).
All magit actions happen pretty much instantaneously, no noticeable delay (so much less than a second). I ran the Emacs profiler and magit status hit about 20% cpu briefly. In the time it took to refresh the profile report it was back to 0%
My spacemacs git layer configuration is
(git :variables
git-magit-status-fullscreen t
magit-diff-refine-hunk t
git-enable-magit-todos-plugin t)
In .spacemacs dotspacemacs/user-config I have the following to ensure closed issues are not included for magit forge. But this should only be an issue when pulling issue uptates, @ f f
in magit status.
(setq forge-topic-list-limit '(100 . -10))
I have git version 2.23.0 installed (2.35.1 is the latest available), so fairly recent.
Magit emacs package is magit-20220203.2302
, so I must have updated after 3rd of February 2020
Another aspect could be the Clojure project itself, especially if its a very very large project. If the slowness is happening on all projects then its probably some Emacs / magit issue
I've just tried on a smaller project (https://github.com/jumarko/clojure-experiments/) and it's faster - but still far from "instanteneous"; perhaps 1.5-2 seconds
I studied a few resources, notably https://jakemccrary.com/blog/2020/11/14/speeding-up-magit, and learned about magit-refresh-verbose After implementing the suggestion the time went down from 2.5 seconds to less than a second! Before:
Refreshing buffer 'magit: codescene'...
magit-insert-error-header 9.9e-05
magit-insert-diff-filter-header 0.033033 !!
magit-insert-head-branch-header 0.097403 !!
magit-insert-upstream-branch-header 0.000375
magit-insert-push-branch-header 0.066162 !!
magit-insert-tags-header 0.459343 !!
magit-insert-status-headers 0.70068 !!
magit-insert-merge-log 0.028536 !
magit-insert-rebase-sequence 0.000688
magit-insert-am-sequence 0.000169
magit-insert-sequencer-sequence 0.000325
magit-insert-bisect-output 0.000172
magit-insert-bisect-rest 4.4e-05
magit-insert-bisect-log 4.5e-05
magit-insert-untracked-files 0.887013 !!
magit-insert-unstaged-changes 0.119067 !!
magit-insert-staged-changes 0.068917 !!
magit-insert-stashes 0.145984 !!
magit-insert-unpushed-to-pushremote 0.166327 !!
magit-insert-unpushed-to-upstream-or-recent 0.112718 !!
magit-insert-unpulled-from-pushremote 0.084049 !!
magit-insert-unpulled-from-upstream 3e-06
forge-insert-pullreqs 0.049881 !!
forge-insert-issues 9e-06
Refreshing buffer 'magit: codescene'...done (2.482s)
AFTER:
Refreshing buffer 'magit: codescene'...
magit-insert-merge-log 0.032955 !!
magit-insert-rebase-sequence 0.000745
magit-insert-am-sequence 0.000161
magit-insert-sequencer-sequence 0.001377
magit-insert-bisect-output 0.000163
magit-insert-bisect-rest 5.1e-05
magit-insert-bisect-log 4.4e-05
magit-insert-untracked-files 0.407428 !!
magit-insert-unstaged-changes 0.121312 !!
magit-insert-staged-changes 0.073821 !!
magit-insert-stashes 0.147271 !!
forge-insert-pullreqs 0.039658 !!
forge-insert-issues 5e-06
Refreshing buffer 'magit: codescene'...done (0.908s)
This was also helpful: https://magit.vc/manual/magit/Performance.html#Committing-Performance-1
(remove-hook 'server-switch-hook 'magit-commit-diff)