Skip to content
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

add: use preload-index and fscache for performance #971

Merged

Conversation

jeffhostetler
Copy link

Teach "add" to use preload-index and fscache features
to improve performance on very large repositories.

During an "add", a call is made to run_diff_files()
which calls check_remove() for each index-entry. This
calls lstat(). On Windows, the fscache code intercepts
the lstat() calls and builds a private cache using the
FindFirst/FindNext routines, which are much faster.

Somewhat independent of this, is the preload-index code
which distributes some of the start-up costs across
multiple threads.

Signed-off-by: Jeff Hostetler jeffhost@microsoft.com

Teach "add" to use preload-index and fscache features
to improve performance on very large repositories.

During an "add", a call is made to run_diff_files()
which calls check_remove() for each index-entry.  This
calls lstat().  On Windows, the fscache code intercepts
the lstat() calls and builds a private cache using the
FindFirst/FindNext routines, which are much faster.

Somewhat independent of this, is the preload-index code
which distributes some of the start-up costs across
multiple threads.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
@dscho dscho merged commit 08e752e into git-for-windows:master Nov 23, 2016
@dscho
Copy link
Member

dscho commented Nov 23, 2016

Excellent!

@dscho
Copy link
Member

dscho commented Nov 23, 2016

Oops, I just realized something... read_cache_preload() does nothing else than read_cache() followed by some quick updates regarding the up-to-date state of the index: https://github.com/git/git/blob/v2.10.2/preload-index.c#L106-L113

(Please note that read_cache() is nothing else than read_index(&the_index), a hold-over from the time when Git's original working title was still known: dircache.)

So maybe the best course of action is to keep the original read_cache() and add the read_cache_preload(&pathspec); after parsing the pathspecs... That should have the same performance, maybe even better, because the second call will not really read the index but realize that it was already read, and perform only the stat updates: https://github.com/git/git/blob/v2.10.2/preload-index.c#L34-L68

I am thinking about something like this: dscho@8f26c6a

What do you think @jeffhostetler ?

dscho added a commit to git-for-windows/build-extra that referenced this pull request Nov 23, 2016
Performance of `git add` in large worktrees [was
improved](git-for-windows/git#971).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho added a commit to dscho/git that referenced this pull request Nov 24, 2016
…er/add_preload_fscache

add: use preload-index and fscache for performance
dscho pushed a commit that referenced this pull request Nov 29, 2016
…fscache

add: use preload-index and fscache for performance
dscho added a commit to dscho/git that referenced this pull request Nov 29, 2016
…er/add_preload_fscache

add: use preload-index and fscache for performance
dscho pushed a commit that referenced this pull request Nov 30, 2016
…fscache

add: use preload-index and fscache for performance
@jeffhostetler jeffhostetler deleted the jeffhostetler/add_preload_fscache branch December 1, 2016 19:55
dscho added a commit that referenced this pull request Dec 6, 2016
…fscache

add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Dec 12, 2016
…fscache

add: use preload-index and fscache for performance
@dscho dscho added this to the v2.11.0 milestone Dec 22, 2016
dscho added a commit that referenced this pull request Jan 11, 2017
…fscache

add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 18, 2017
…fscache

add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 18, 2017
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 18, 2017
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 18, 2017
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 18, 2017
…fscache

add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 24, 2017
…fscache

add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 24, 2017
…fscache

add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 24, 2017
…fscache

add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 25, 2017
…fscache

add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 25, 2017
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 22, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 22, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 23, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 23, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 24, 2024
…fscache

add: use preload-index and fscache for performance
dscho added a commit to microsoft/git that referenced this pull request Apr 24, 2024
…er/add_preload_fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 24, 2024
…fscache

add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Apr 25, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 25, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 25, 2024
…fscache

add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Apr 25, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 25, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 26, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 26, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 26, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 26, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 26, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 27, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 27, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 29, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 29, 2024
…fscache

add: use preload-index and fscache for performance
dscho added a commit to microsoft/git that referenced this pull request Apr 29, 2024
…er/add_preload_fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 29, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Apr 29, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request May 1, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request May 1, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request May 1, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request May 4, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request May 4, 2024
…fscache

add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request May 9, 2024
…fscache

add: use preload-index and fscache for performance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants