Skip to content

Windows: improve checkout performance with large numbers of files#704

Closed
dscho wants to merge 1 commit into
gitgitgadget:masterfrom
dscho:unlink-perf-gfw
Closed

Windows: improve checkout performance with large numbers of files#704
dscho wants to merge 1 commit into
gitgitgadget:masterfrom
dscho:unlink-perf-gfw

Conversation

@dscho
Copy link
Copy Markdown
Member

@dscho dscho commented Aug 17, 2020

Jeff Hostetler contributed this patch to Git for Windows a while ago after measuring ~15% improvement with a very, very large worktree:

I ran a series of timing tests on the Office repo on my Z440 desktop. This was a full enlistment at HEAD. I ran git sparse-checkout disable to populate the entire worktree and then git sparse-checkout init --cone to delete everything except the files at root. I repeated that sequence 3 times.

Each init needed to delete about 2.1M files.

git sparse-checkout init

old: 636.1s, 638.3s, 637.2s, 637.2s
new: 535.9s, 544.8s, 533.3s, 538.0s

In this example, run time was decreased by 15%.

Update mingw_unlink() to first try to delete the file with existing
permissions before trying to force it.

Windows throws an error when trying to delete a read-only file.  The
mingw_unlink() compatibility wrapper always tries to _wchmod(666) the
file before calling _wunlink() to avoid that error.  However, since
most files in the worktree are already writable, this is usually
wasted effort.

Update mingw_unlink() to just call DeleteFileW() directly and if that
succeeds return.  If that fails, fall back into the existing code path
to update the permissions and use _wunlink() to get the existing
error code mapping.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
Copy link
Copy Markdown
Member Author

dscho commented Aug 17, 2020

/preview

@gitgitgadget
Copy link
Copy Markdown

gitgitgadget Bot commented Aug 17, 2020

Preview email sent as pull.704.git.1597659175677.gitgitgadget@gmail.com

@dscho
Copy link
Copy Markdown
Member Author

dscho commented Aug 17, 2020

/submit

@gitgitgadget
Copy link
Copy Markdown

gitgitgadget Bot commented Aug 17, 2020

@gitgitgadget
Copy link
Copy Markdown

gitgitgadget Bot commented Aug 17, 2020

This branch is now known as jh/mingw-unlink.

@gitgitgadget
Copy link
Copy Markdown

gitgitgadget Bot commented Aug 17, 2020

This patch series was integrated into seen via git@99fc326.

@gitgitgadget gitgitgadget Bot added the seen label Aug 17, 2020
@gitgitgadget
Copy link
Copy Markdown

gitgitgadget Bot commented Aug 18, 2020

This patch series was integrated into seen via git@d85575f.

@gitgitgadget
Copy link
Copy Markdown

gitgitgadget Bot commented Aug 18, 2020

This patch series was integrated into next via git@fb53a3d.

@gitgitgadget gitgitgadget Bot added the next label Aug 18, 2020
@gitgitgadget
Copy link
Copy Markdown

gitgitgadget Bot commented Aug 20, 2020

This patch series was integrated into seen via git@5a04826.

@gitgitgadget
Copy link
Copy Markdown

gitgitgadget Bot commented Aug 20, 2020

This patch series was integrated into next via git@5a04826.

@gitgitgadget
Copy link
Copy Markdown

gitgitgadget Bot commented Aug 20, 2020

This patch series was integrated into master via git@5a04826.

@gitgitgadget gitgitgadget Bot added the master label Aug 20, 2020
@gitgitgadget gitgitgadget Bot closed this Aug 20, 2020
@gitgitgadget
Copy link
Copy Markdown

gitgitgadget Bot commented Aug 20, 2020

Closed via 5a04826.

@dscho dscho deleted the unlink-perf-gfw branch August 24, 2020 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants