1

We're talking tens of seconds. In comparison, git status in the same repo is nearly instantaneous.

Here is my profiling result on refresh:

- command-execute                                              121545  91%
 - call-interactively                                          121531  91%
  - funcall-interactively                                      120909  90%
   - magit-refresh                                             116330  87%
    - magit-refresh-buffer                                     116260  87%
     - apply                                                   116229  87%
      - magit-status-refresh-buffer                            116217  87%
       - magit-run-section-hook                                116197  87%
        - apply                                                116197  87%
         - magit-insert-untracked-files                        115406  86%
          - magit-insert-files                                 115201  86%
           - magit-insert-files                                113817  85%
            - magit-insert-files                               111957  83%
             - magit-insert-files                              107594  80%
              - magit-insert-files                              96792  72%
               - magit-insert-files                             78624  58%
                - magit-insert-files                            51801  38%
                 - magit-insert-files                           29160  21%
                  - magit-insert-files                          11094   8%
                   + magit-insert-files                          5772   4%
                   + run-hook-with-args-until-success                412   0%
                   + magit-get-section                            400   0%
                   + magit-section-ident                          293   0%
                   + magit-file-section                            48   0%
                   + eieio-oref-default                            20   0%
                     eieio-oset                                    16   0%
                   + magit-insert-child-count                      12   0%
                     eieio-oref                                     8   0%
                     class-p                                        4   0%
                  + magit-get-section                             872   0%
                  + run-hook-with-args-until-success                716   0%
                  + magit-section-ident                           180   0%
                  + magit-file-section                            156   0%
                  + eieio-oref                                     48   0%
                  + eieio-oref-default                             28   0%
                  + magit-insert-heading                           20   0%
                  + magit-insert-child-count                       20   0%
                  + eieio-oset                                     16   0%
                    string-prefix-p                                16   0%
                    class-p                                         4   0%
                 + magit-get-section                             1304   0%
                 + run-hook-with-args-until-success                964   0%
                 + magit-section-ident                            223   0%
                 + magit-file-section                              83   0%
                 + eieio-oset                                      32   0%
                 + magit-insert-heading                            16   0%
                   eieio-oref                                      16   0%
                 + eieio-oref-default                              16   0%
                 + magit-insert-child-count                         8   0%
                + magit-get-section                              2669   2%
                + run-hook-with-args-until-success                692   0%
                + magit-section-ident                             347   0%
                + magit-file-section                              152   0%
                + eieio-oref                                       36   0%
                + eieio-oset                                       32   0%
                + eieio-oref-default                               28   0%
                + magit-insert-child-count                          8   0%
                + magit-insert-heading                              8   0%
                  string-prefix-p                                   4   0%
               + run-hook-with-args-until-success                 724   0%
               + magit-get-section                                604   0%
               + magit-file-section                               212   0%
               + magit-section-ident                              124   0%
               + magit-insert-heading                              20   0%
                 eieio-oref                                        20   0%
               + eieio-oset                                        12   0%
               + magit-insert-child-count                          12   0%
                 eieio-oref-default                                 4   0%
              + run-hook-with-args-until-success                  191   0%
              + magit-get-section                                 180   0%
              + magit-section-ident                                20   0%
              + magit-file-section                                 16   0%
              + magit-insert-heading                               16   0%
                eieio-oref                                         12   0%
                eieio-oset                                          4   0%
                magit-insert-child-count                            4   0%
             + run-hook-with-args-until-success                    64   0%
             + magit-file-section                                  24   0%
             + eieio-oref                                          12   0%
             + magit-insert-child-count                             8   0%
             + eieio-oset                                           4   0%
            + run-hook-with-args-until-success                     16   0%
            + magit-file-section                                    8   0%
              eieio-oset                                            4   0%
           + magit-insert-heading                                   4   0%
           + run-hook-with-args-until-success                       4   0%
          + magit-untracked-files                                  57   0%
            magit-insert-child-count                                4   0%
         + magit-insert-unpushed-to-upstream-or-recent                666   0%
         + magit-insert-unstaged-changes                           53   0%
         + magit-insert-status-headers                             36   0%
         + magit-insert-staged-changes                             14   0%
         + magit-insert-bisect-output                               2   0%
    + magit-auto-revert-buffers                                    60   0%
    + magit-run-hook-with-benchmark                                 2   0%
   + execute-extended-command                                    1251   0%
   + revert-buffer                                                790   0%
   + push-button                                                  779   0%
   + package-menu-execute                                         499   0%
   + isearch-printing-char                                        480   0%
   + next-line                                                    285   0%
   + magit-next-line                                              214   0%
   + isearch-repeat-forward                                        96   0%
   + isearch-forward                                               75   0%
   + package-menu-describe-package                                 33   0%
   + profiler-report-toggle-entry                                  23   0%
     end-of-buffer                                                 20   0%
   + previous-line                                                  4   0%
     other-window                                                   3   0%
   + magit-previous-line                                            3   0%
     right-char                                                     2   0%
  + byte-code                                                     620   0%
+ ...                                                           10534   7%
+ url-http-generic-filter                                         602   0%
+ timer-event-handler                                             174   0%
  mouse-fixup-help-message                                        163   0%
+ package-menu--post-refresh                                      156   0%
+ redisplay_internal (C function)                                 145   0%

So I seem to have too many untracked files. Still, tens of seconds...


As a side note, I have a ~/.gitignore file in my home, which I use in my ~/.gitconfig as such:

[core]
    excludesfile = ~/.gitignore

This works when I run git status, but doesn't seem to apply when running magit-status. My whole several virtualenv content show up in magit-status.

  • Is there something I can do to speed this up?
  • How can I make magit take the excludefiles in my .gitconfig?
  • Are the recursive calls to magit-insert-files expected?
  • Other stuff seems to happen (see jump from 21 % CPU to 8 %, I don't know where that loss occurred)
  • Tell us which of the documented performance measures you've already taken? Also which system you're running, the versions of git and magit, and whether the issues are dependent on any particular repository. – phils Jan 17 at 12:17
  • 1
    "In comparison, git status in the same repo is nearly instantaneous." -- FYI that's not a comparable command. magit-status does dramatically more. – phils Jan 17 at 12:18
1

There are many things that could make Magit slow and also a few things that can be done to speed it up. The manual as a node about that.

Maybe something there helps. If not, then you would have to provide more information.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.