Why branch checkout on Windows is so slow, but on Linux so fast?

0

Issue

I got a git repository with several submodules and got horrible performance on my Windows 10 build 15063, while on my Linux Mint 18 Sarah everything is fast as the speed light.

Both on Windows and Linux using the Smartgit client, where I can do checkout on a test branch, but takes like 3 minutes to finish the process on the Windows machine:

Check Out Branch
    D:\SublimeText\Data\Packages> git.exe checkout test
    Switched to branch 'test'
    D:\SublimeText\Data\Packages\Default Syntax> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Force Rewrite Sublime Settings> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Side-by-Side Settings> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Overwrite Commit Completion> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Sublime Text Studio> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\MarkdownLight> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Fixed Selections Clear> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\SublimeCodeIntel> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Open Auto Completion> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\amxmodx> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Shell Script> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Notepad++ Color Scheme> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\LaTeXTools> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\.versioning> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Toolbar> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\BBCode> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Select All Spelling Errors> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Markdown to BB Code Converter> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\All Autocomplete> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Package Control> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\AutoFileName> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\SQL Keyword Uppercase> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Fix Project Switch Restart Bug> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Indent and braces> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Override Unpacked Packages> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\GotoLastEditEnhanced> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\PowerCursors> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\FuzzyFilePath> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Clear Cursors Carets> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\ANSIescape> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Preferences Editor> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\BufferScroll> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\PackageDev> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Clipboard Scope Copy> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\SideBarEnhancements> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\View Settings Freely> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Fix Selection After Indent> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Amxx Pawn> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\SublimeREPL> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\SyncedSideBar> git.exe fetch --progress --prune --recurse-submodules=no origin
    D:\SublimeText\Data\Packages\Active View Jump Back> git.exe fetch --progress --prune --recurse-submodules=no origin

Otherwise on the Linux machine, using the same repository, I can do the checkout on a test branch in something like 5 seconds:

Check Out Branch
    ~/.config/sublime-text-3/Packages> git checkout test_linux
    Switched to branch 'test'

Is it possible to make the git checkout on Windows as fast as the git checkout on Linux?

I found this other question, but I dit not understand if it applies here:

  1. Git is slow on pushing submodules change to origin

Update

After @derHugo commentary, I find out that running git from the command line on windows and typing git checkout test is as fast as on linux.

Now I would have to change the question and ask why the Smartgit client for Windows is doing this slow thing, while the Linux one, doesn’t.

How can I disable this slow checkout on the Windows Smartgit client and what will be the consequences?

Solution

SmartGit seem to execute a series of git.exe command, each one having to spawn a bash session (spawning/starting a new shell is slow).
See more at “How are msys, msys2, and msysgit related to each other?

If you do the same in a git bash session, all those commands (for each submodule checkout) can reuse the current shell session: much faster, even on Windows.

Answered By – VonC

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More