Skip to content

Speed up yadm by caching results of git calls #505

@rasa

Description

@rasa

Is your feature request related to a problem? Please describe.

yadm can be slow on slower systems.

Describe the solution you'd like

Cache expensive git calls.

Additional context

When I run yadm commit on my system, these are the commands that are run, and how often (found using GIT_TRACE=1):

  Count  Command
-------  ----------------------------------------- 
      2  git fetch --update-head-ok
      2  git maintenance run --auto --no-quiet
      2  git merge FETCH_HEAD
      2  git rev-parse --git-dir
      2  git rev-parse --git-path objects
      2  git rev-parse --show-prefix
      2  git rev-parse --show-toplevel
      2  git-submodule summary --cached --for-status --summary-limit -1 HEAD
      2  git-submodule summary --files --for-status --summary-limit -1
      4  git config --file=.config/yadm/config --bool yadm.alt-copy
      4  git config --file=.config/yadm/config --bool yadm.auto-alt
      4  git config --file=.config/yadm/config --bool yadm.auto-perms
      4  git config --file=.config/yadm/config --bool yadm.auto-private-dirs
      4  git config --file=.config/yadm/config --bool yadm.gpg-perms
      4  git config --file=.config/yadm/config --bool yadm.ssh-perms
      4  git config --file=.config/yadm/config yadm.git-program
      4  git config --get-all local.class
      4  git config core.worktree
      4  git config local.arch
      4  git config local.hostname
      4  git config local.os
      4  git config local.user
      4  git ls-files
      4  git-sh-i18n--envsubst 'usage: $dashless $USAGE'
      4  git-sh-i18n--envsubst --variables 'usage: $dashless $USAGE'

The results of at least the git config commands can be cached to speed things up, yes?

If you are open to this enhancement, I will draft a PR for your review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions