New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git diff unusually slow #2837

Closed
stefanobaghino opened this Issue Jan 12, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@stefanobaghino

stefanobaghino commented Jan 12, 2018

  • Your Windows build number: (Type ver at a Windows Command Prompt)
    Microsoft Windows [Version 10.0.16299.125]

  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)
    git diff

  • What's wrong / what should be happening instead:
    The command takes ~450 ms to execute / The execution should be nearly instantaneous

  • Strace of the failing command, if applicable: (If some_command is failing, then run strace -o some_command.strace -f some_command some_args, and link the contents of some_command.strace in a gist here)
    N/A

When working on Ubuntu, I use a fairly complex command prompt that detects if my working directory is part of a git repository. If so, the prompt also adds information about the current branch and its status.

I noticed that there was an unusual latency (~1 second) between the end of a command and the display of the prompt, so I set -x to identify the bottleneck and realized that half of the time was spent running git diff, which I then confirmed by running the command with time (which consistently reports ~450 milliseconds).

If this can be useful, I'm currently running the Docker for Windows (version 17.12.0-ce-win45 (15017), channel edge, build 6bbf198) using the experimental option "Linux containers on Windows" and by running the same git diff on the same repository inside a docker container based on the ubuntu image, the times are slightly better (around ~350 milliseconds).

Furthermore, running git diff on the bash that is installed as part of Git for Windows yields even better times (~200 milliseconds).

On a virtual machine provisioned on OpenStack with comparable resources but running Ubuntu natively, the execution of git diff on the same repository is nearly instantaneous (~1 millisecond).

I can imagine this is due to the many levels of indirections that are involved in the whole WSL, but I was wondering if there's something in particular that causes this slowdown.

@therealkenc

This comment has been minimized.

Show comment
Hide comment
@therealkenc

therealkenc Jan 12, 2018

Collaborator

#981, #1305, #1566 et al

Collaborator

therealkenc commented Jan 12, 2018

#981, #1305, #1566 et al

@stefanobaghino

This comment has been minimized.

Show comment
Hide comment
@stefanobaghino

stefanobaghino Jan 13, 2018

@therealkenc Sorry, I searched but couldn't find them. Thanks for reporting the original issue, I'll make sure to follow #981.

stefanobaghino commented Jan 13, 2018

@therealkenc Sorry, I searched but couldn't find them. Thanks for reporting the original issue, I'll make sure to follow #981.

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