Skip to content

Conversation

@atetubou
Copy link

In git reset --hard, unpack-trees() is called with oneway_merge().
oneway_merge calls lstat for each files in a repository.
It is bottleneck of git reset --hard, especially in large repository.

This patch improves time by using fscache.
In chromium repository, time of git reset --hard is changed like below.
I took 3 times stats in the repository.

master:
TotalSeconds: 21.0337971
TotalSeconds: 20.0046612
TotalSeconds: 20.6501752
Avg: 20.5628778333333

this patch:
TotalSeconds: 4.8552376
TotalSeconds: 4.8722343
TotalSeconds: 4.9268245
Avg: 4.88476546666667

Signed-off-by: Takuto Ikuta [email protected]

In git reset --hard, unpack-trees() is called with oneway_merge().
oneway_merge calls lstat for each files in a repository.
It is bottleneck of git reset --hard, especially in large repository.

This patch improves time by using fscache.
In chromium repository, time of git reset --hard is changed like below.
I took 3 times stats in the repository.

master:
TotalSeconds: 21.0337971
TotalSeconds: 20.0046612
TotalSeconds: 20.6501752
Avg: 20.5628778333333

this patch:
TotalSeconds: 4.8552376
TotalSeconds: 4.8722343
TotalSeconds: 4.9268245
Avg: 4.88476546666667

Signed-off-by: Takuto Ikuta <[email protected]>
@dscho dscho merged commit 4584fb7 into git-for-windows:master Jan 17, 2018
@dscho
Copy link
Member

dscho commented Jan 17, 2018

Thank you very much!

@dscho dscho added this to the v2.15.1(3) milestone Jan 17, 2018
dscho added a commit to git-for-windows/build-extra that referenced this pull request Jan 17, 2018
With lots of files, `git reset --hard` [is now a lot
faster](git-for-windows/git#1427) when the
FSCache feature is in effect.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this pull request Jan 18, 2018
@dscho dscho modified the milestones: v2.15.1(3), v2.16.0 Jan 18, 2018
git-for-windows-ci pushed a commit that referenced this pull request Jan 20, 2018
git-for-windows-ci pushed a commit that referenced this pull request Jan 22, 2018
git-for-windows-ci pushed a commit that referenced this pull request Jan 22, 2018
dscho added a commit that referenced this pull request Jan 22, 2018
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.

2 participants