Skip to content

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 [email protected]

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 <[email protected]>
@dschodscho merged commit 08e752e into git-for-windows:masterNov 23, 2016
@dscho
Copy link
Member

Excellent!

@dscho
Copy link
Member

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 <[email protected]>
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
@jeffhostetlerjeffhostetler 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
@dschodscho 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 Jan 6, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 7, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 7, 2025
…fscache add: use preload-index and fscache for performance
@dschodscho mentioned this pull request Jan 7, 2025
dscho added a commit to dscho/git that referenced this pull request Jan 7, 2025
…er/add_preload_fscache add: use preload-index and fscache for performance
dscho added a commit to dscho/git that referenced this pull request Jan 7, 2025
…er/add_preload_fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 7, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 7, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 8, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 8, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 8, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 8, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 9, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 9, 2025
…fscache add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 17, 2025
…fscache add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 27, 2025
…fscache add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 27, 2025
…fscache add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 27, 2025
…fscache add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Jan 27, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 27, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 28, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Jan 28, 2025
…fscache add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Feb 3, 2025
…fscache add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Feb 5, 2025
…fscache add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Feb 5, 2025
…fscache add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Feb 5, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Feb 5, 2025
…fscache add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Feb 6, 2025
…fscache add: use preload-index and fscache for performance
dscho added a commit that referenced this pull request Feb 6, 2025
…fscache add: use preload-index and fscache for performance
git-for-windows-ci pushed a commit that referenced this pull request Feb 6, 2025
…fscache add: use preload-index and fscache for performance
Sign up for freeto 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.

2 participants

@jeffhostetler@dscho