Skip to content

GitHub Desktop runs long running update-index #12191

Closed

Description

@mttkay

Breaking this out of a comment I left on an older issue.

I'm trying to get to the bottom of why GitHub Desktop 2.7.x feels so much slower than older versions. There are several issues where I have observed poor performance or long delays that I am not sure are related, so to keep this focused I will point out one I found evidence for:

I have a project with a pre-commit hook defined that runs tests. The project is small so this should be fast to run, no more than a few seconds (easy to verify when using the git CLI.)

I just committed via the app (2.7.2-linux1) and it took over 1 minute for the commit to go through. I looked at the logs and saw this:

2021-05-11T04:10:57.904Z - info: [ui] Executing updateIndex: git update-index --add --remove --replace -z --stdin (took 62.626s)

Why is GitHub Desktop doing this and why does it take so long? This is a small side-project of mine, so it is not a problem with repository size.

My expected behavior would have been for the app to do as I tell it to: execute a commit, including any hooks defined, not run a 1 minute update-index op.

Is this expected behavior, and what can be done to speed this up?

Activity

  1. mttkay commented on May 11, 2021

    @mttkay
    Author

    I now realize it seems to be doing this for every commit. I committed again, and the logs now say:

    2021-05-11T04:10:57.904Z - info: [ui] Executing updateIndex: git update-index --add --remove --replace -z --stdin (took 62.626s)
    2021-05-11T04:11:05.935Z - info: [ui] Executing createCommit: git commit -F - (took 8.016s)
    2021-05-11T04:11:06.342Z - info: [ui] [Timing] Action 'create commit' for 'stargazer' took 71.103s
    2021-05-11T04:19:25.717Z - info: [ui] Executing updateIndex: git update-index --add --remove --replace -z --stdin (took 4.378s)
    2021-05-11T04:19:27.574Z - info: [ui] Executing createCommit: git commit -F - (took 1.841s)
    2021-05-11T04:19:27.854Z - info: [ui] [Timing] Action 'create commit' for 'stargazer' took 6.556s
    

    So subsequent runs of update-index are much faster (4s vs 62s), but this still adds considerable overhead and app latency. I have used git for close to 20 years now and have never before had to git update-index. It looks like this is used to temper with the file cache:

    Modifies the index or directory cache. Each file mentioned is updated into the index and any unmerged or needs updating state is cleared.
    

    Does the app use this to sync its UI to the local git index state? Is there a way to speed this up or run this less frequently?

  2. steveward commented on Oct 7, 2024

    @steveward
    Contributor

    Adding to #10625 and closing out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions