Skip to content

Redundant calls leads to slow performance in forge-dispatch #711

@CeleritasCelery

Description

@CeleritasCelery

Thank you for creating this package. I have been using forge on a large repo, and in the magit dispatch popup it will typically take about 15 seconds after I hit N (forge-dispatch) before the transient menu will show up. I wondered why it took so long, so I enabled magit-process-extreme-logging to see the commands. Here is the result:

$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel
$ git … rev-parse --git-dir
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false config -z --get-all --include forge.remote
$ git … --no-pager --literal-pathspecs -c core.preloadindex\=true -c log.showSignature\=false -c color.ui\=false -c color.diff\=false remote get-url origin
$ git … rev-parse --show-toplevel
$ git … rev-parse --show-cdup [2 times]
$ git … rev-parse --show-toplevel

There are 176 calls to git, but only 6 unique ones. Each set of operations is getting called 22 times. And that is just to open the dispatch menu. It looks like these are part of calls to forge-get-repository. That function does use magit--with-refresh-cache, but the cache is never initialized so it never gets used. I was going to try and initialize magit--refresh-cache myself but I couldn't figure out how to to do that in transient-define-prefix.

Magit v4.1.0-11-g7370a47a, Transient 0.7.4, Forge 0.4.4, Git 2.46.0, Emacs 29.4, darwin

Metadata

Metadata

Assignees

No one assigned

    Labels

    movedThis issue has been moved to a discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions