git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
@ 2017-11-27  4:27 Takuto Ikuta
  2017-11-27  4:35 ` Junio C Hamano
  0 siblings, 1 reply; 12+ messages in thread
From: Takuto Ikuta @ 2017-11-27  4:27 UTC (permalink / raw)
  To: git

Do not call prepare_packed_git for every refs.
In fetch-pack, git list ups entries in .git/objects/pack
directory for each refs.
Such behavior makes git fetch-pack slow for the repository having the
large number of refs, especially for windows.

For chromium repository, having more than 300000 remote refs, git fetch
takes more than 3 minutes if fetch-pack runs on my windows workstation.
This patch improves the time to around 17 seconds in the same machine.

Signed-off-by: Takuto Ikuta <tikuta@google.com>
---
 fetch-pack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fetch-pack.c b/fetch-pack.c
index 008b25d3db087..0184584e80599 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -716,7 +716,7 @@ static int everything_local(struct fetch_pack_args *args,
 	for (ref = *refs; ref; ref = ref->next) {
 		struct object *o;
 
-		if (!has_object_file(&ref->old_oid))
+		if (!has_object_file_with_flags(&ref->old_oid, OBJECT_INFO_QUICK))
 			continue;
 
 		o = parse_object(&ref->old_oid);

--
https://github.com/git/git/pull/437

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
  2017-11-27  4:27 [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack Takuto Ikuta
@ 2017-11-27  4:35 ` Junio C Hamano
  2017-11-27  4:37   ` Jeff King
  0 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2017-11-27  4:35 UTC (permalink / raw)
  To: Takuto Ikuta; +Cc: git, Jeff King

Takuto Ikuta <tikuta@google.com> writes:

> diff --git a/fetch-pack.c b/fetch-pack.c
> index 008b25d3db087..0184584e80599 100644
> --- a/fetch-pack.c
> +++ b/fetch-pack.c
> @@ -716,7 +716,7 @@ static int everything_local(struct fetch_pack_args *args,
>  	for (ref = *refs; ref; ref = ref->next) {
>  		struct object *o;
>  
> -		if (!has_object_file(&ref->old_oid))
> +		if (!has_object_file_with_flags(&ref->old_oid, OBJECT_INFO_QUICK))
>  			continue;
>  

It appears that great minds think alike?

cf. https://public-inbox.org/git/20171120202920.7ppcwmzkxifywtoj@sigill.intra.peff.net/

The 5-patch series that contains the same change as this one is
cooking and will hopefully be in the released version before the end
of the year.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
  2017-11-27  4:35 ` Junio C Hamano
@ 2017-11-27  4:37   ` Jeff King
  2017-11-27  4:53     ` Junio C Hamano
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff King @ 2017-11-27  4:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Takuto Ikuta, git

On Mon, Nov 27, 2017 at 01:35:35PM +0900, Junio C Hamano wrote:

> Takuto Ikuta <tikuta@google.com> writes:
> 
> > diff --git a/fetch-pack.c b/fetch-pack.c
> > index 008b25d3db087..0184584e80599 100644
> > --- a/fetch-pack.c
> > +++ b/fetch-pack.c
> > @@ -716,7 +716,7 @@ static int everything_local(struct fetch_pack_args *args,
> >  	for (ref = *refs; ref; ref = ref->next) {
> >  		struct object *o;
> >  
> > -		if (!has_object_file(&ref->old_oid))
> > +		if (!has_object_file_with_flags(&ref->old_oid, OBJECT_INFO_QUICK))
> >  			continue;
> >  
> 
> It appears that great minds think alike?
> 
> cf. https://public-inbox.org/git/20171120202920.7ppcwmzkxifywtoj@sigill.intra.peff.net/

It's funny that we'd get two patches so close together. AFAIK the
slowness here has been with us for years, and I just happened to
investigate it recently.

> The 5-patch series that contains the same change as this one is
> cooking and will hopefully be in the released version before the end
> of the year.

I'd be curious if the 5th patch there provides an additional speedup for
Takuto's case.

-Peff

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
  2017-11-27  4:37   ` Jeff King
@ 2017-11-27  4:53     ` Junio C Hamano
  2017-11-27  5:01       ` Takuto Ikuta
  2017-11-27  5:04       ` Jeff King
  0 siblings, 2 replies; 12+ messages in thread
From: Junio C Hamano @ 2017-11-27  4:53 UTC (permalink / raw)
  To: Jeff King; +Cc: Takuto Ikuta, git

Jeff King <peff@peff.net> writes:

>> cf. https://public-inbox.org/git/20171120202920.7ppcwmzkxifywtoj@sigill.intra.peff.net/
>
> It's funny that we'd get two patches so close together. AFAIK the
> slowness here has been with us for years, and I just happened to
> investigate it recently.
>
>> The 5-patch series that contains the same change as this one is
>> cooking and will hopefully be in the released version before the end
>> of the year.
>
> I'd be curious if the 5th patch there provides an additional speedup for
> Takuto's case.

Indeed, it is a very good point.

IIUC, the 5th one is about fetching tons of refs that you have never
seen, right?  If a repository that has trouble with everything-local
is suffering because it right now has 300k remote-tracking branches,
I'd imagine that these remote-tracking branches are being added at a
considerable rate, so I'd not be surprised if these "new" refs
benefits from that patch.  And it would be nice to know how much a
real life scenario actually does improve.

Thanks.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
  2017-11-27  4:53     ` Junio C Hamano
@ 2017-11-27  5:01       ` Takuto Ikuta
  2017-11-27 21:24         ` Johannes Schindelin
  2017-11-27  5:04       ` Jeff King
  1 sibling, 1 reply; 12+ messages in thread
From: Takuto Ikuta @ 2017-11-27  5:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, git

2017-11-27 13:53 GMT+09:00 Junio C Hamano <gitster@pobox.com>:
> Jeff King <peff@peff.net> writes:
>
>>> cf. https://public-inbox.org/git/20171120202920.7ppcwmzkxifywtoj@sigill.intra.peff.net/
>>
>> It's funny that we'd get two patches so close together. AFAIK the
>> slowness here has been with us for years, and I just happened to
>> investigate it recently.

Yes, thank you for let me know.
Please ignore my patch, sorry.

>>
>>> The 5-patch series that contains the same change as this one is
>>> cooking and will hopefully be in the released version before the end
>>> of the year.
>>
>> I'd be curious if the 5th patch there provides an additional speedup for
>> Takuto's case.
>
> Indeed, it is a very good point.
>
> IIUC, the 5th one is about fetching tons of refs that you have never
> seen, right?  If a repository that has trouble with everything-local
> is suffering because it right now has 300k remote-tracking branches,
> I'd imagine that these remote-tracking branches are being added at a
> considerable rate, so I'd not be surprised if these "new" refs
> benefits from that patch.  And it would be nice to know how much a
> real life scenario actually does improve.
>
> Thanks.

In chromium repository,  your 5th patch does not improve performance,
took more than 5 minutes to run fetch on windows.
4th patch is very important for the repository in daily fetch.
I hope your 4th patch will be merged.

Thanks.
-- 
Takuto Ikuta
Software Engineer in Tokyo
Chrome Infrastructure (goma team)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
  2017-11-27  4:53     ` Junio C Hamano
  2017-11-27  5:01       ` Takuto Ikuta
@ 2017-11-27  5:04       ` Jeff King
  1 sibling, 0 replies; 12+ messages in thread
From: Jeff King @ 2017-11-27  5:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Takuto Ikuta, git

On Mon, Nov 27, 2017 at 01:53:34PM +0900, Junio C Hamano wrote:

> > I'd be curious if the 5th patch there provides an additional speedup for
> > Takuto's case.
> 
> Indeed, it is a very good point.
> 
> IIUC, the 5th one is about fetching tons of refs that you have never
> seen, right?  If a repository that has trouble with everything-local
> is suffering because it right now has 300k remote-tracking branches,
> I'd imagine that these remote-tracking branches are being added at a
> considerable rate, so I'd not be surprised if these "new" refs
> benefits from that patch.  And it would be nice to know how much a
> real life scenario actually does improve.

Right, I think it will only kick in for new refs (and maybe deleted
ones, but I didn't check).

I actually did have a real life scenario that was improved, but it's not
very typical. As I've mentioned before, we keep a big shared-object
repository for forks of a single repo, so a fairly common operation is

  git -C network.git fetch ../$fork.git +refs/*:refs/remotes/$fork/*

The first time that's run on a fork, everything looks like a new ref.

So "real life", but thankfully not life for most git users. :)

-Peff

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
  2017-11-27  5:01       ` Takuto Ikuta
@ 2017-11-27 21:24         ` Johannes Schindelin
  2017-11-27 23:52           ` Junio C Hamano
  0 siblings, 1 reply; 12+ messages in thread
From: Johannes Schindelin @ 2017-11-27 21:24 UTC (permalink / raw)
  To: Takuto Ikuta; +Cc: Junio C Hamano, Jeff King, git

Hi,

On Mon, 27 Nov 2017, Takuto Ikuta wrote:

> 2017-11-27 13:53 GMT+09:00 Junio C Hamano <gitster@pobox.com>:
> > Jeff King <peff@peff.net> writes:
> >
> >>> The 5-patch series that contains the same change as this one is
> >>> cooking and will hopefully be in the released version before the end
> >>> of the year.
> >>
> >> I'd be curious if the 5th patch there provides an additional speedup
> >> for Takuto's case.
> >
> > Indeed, it is a very good point.
> >
> > IIUC, the 5th one is about fetching tons of refs that you have never
> > seen, right?  If a repository that has trouble with everything-local
> > is suffering because it right now has 300k remote-tracking branches,
> > I'd imagine that these remote-tracking branches are being added at a
> > considerable rate, so I'd not be surprised if these "new" refs
> > benefits from that patch.  And it would be nice to know how much a
> > real life scenario actually does improve.
> >
> > Thanks.
> 
> In chromium repository,  your 5th patch does not improve performance,
> took more than 5 minutes to run fetch on windows.
> 4th patch is very important for the repository in daily fetch.
> I hope your 4th patch will be merged.

If you want it in Git for Windows early (where performance is
traditionally worse than on Linux because Git is really optimized for
Linux), I would not mind a Pull Request at
https://github.com/git-for-windows/git.

My current plan is to release a new Git for Windows version on Wednesday,
to allow for a new cURL version to be bundled.

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
  2017-11-27 21:24         ` Johannes Schindelin
@ 2017-11-27 23:52           ` Junio C Hamano
  2017-11-28  0:33             ` Johannes Schindelin
  0 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2017-11-27 23:52 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Takuto Ikuta, Jeff King, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> My current plan is to release a new Git for Windows version on Wednesday,
> to allow for a new cURL version to be bundled.

Is this an updated 2.15.0 or are you planning to package 2.15.1?  I
am asking because you earlier asked me to hold 2.15.1 while you were
away last week and there are accumulated changes on 'maint'.

As I won't be online later this week, unless I cut 2.15.1 today or
early tomorrow, it will have to be done early next week, and I'd
prefer not to do 2.15.1 _immediately_ after a platform announces
an updated release of 2.15.0 for obvious reasons.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
  2017-11-27 23:52           ` Junio C Hamano
@ 2017-11-28  0:33             ` Johannes Schindelin
  2017-11-28  1:58               ` Takuto Ikuta
  0 siblings, 1 reply; 12+ messages in thread
From: Johannes Schindelin @ 2017-11-28  0:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Takuto Ikuta, Jeff King, git

Hi Junio,

On Tue, 28 Nov 2017, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > My current plan is to release a new Git for Windows version on Wednesday,
> > to allow for a new cURL version to be bundled.
> 
> Is this an updated 2.15.0 or are you planning to package 2.15.1?

If there is a 2.15.1 to pick up for me, I'll take it. Otherwise it'll be
Git for Windows v2.15.0(2).

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
  2017-11-28  0:33             ` Johannes Schindelin
@ 2017-11-28  1:58               ` Takuto Ikuta
  2017-11-28 11:27                 ` Johannes Schindelin
  0 siblings, 1 reply; 12+ messages in thread
From: Takuto Ikuta @ 2017-11-28  1:58 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, Jeff King, git

Hi Johannes,

As long as this PR is included in next Git for Windows release, I
won't suffer from slow git fetch.
https://github.com/git-for-windows/git/pull/1372

But I sent you 2 PRs to follow right way.
https://github.com/git-for-windows/git/pull/1379
https://github.com/git-for-windows/git/pull/1380
Feel free to merge these PRs.

Thanks.

2017-11-28 9:33 GMT+09:00 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> Hi Junio,
>
> On Tue, 28 Nov 2017, Junio C Hamano wrote:
>
>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>>
>> > My current plan is to release a new Git for Windows version on Wednesday,
>> > to allow for a new cURL version to be bundled.
>>
>> Is this an updated 2.15.0 or are you planning to package 2.15.1?
>
> If there is a 2.15.1 to pick up for me, I'll take it. Otherwise it'll be
> Git for Windows v2.15.0(2).
>
> Ciao,
> Dscho



-- 
Takuto Ikuta
Software Engineer in Tokyo
Chrome Infrastructure (goma team)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
  2017-11-28  1:58               ` Takuto Ikuta
@ 2017-11-28 11:27                 ` Johannes Schindelin
  2017-11-28 11:35                   ` Takuto Ikuta
  0 siblings, 1 reply; 12+ messages in thread
From: Johannes Schindelin @ 2017-11-28 11:27 UTC (permalink / raw)
  To: Takuto Ikuta; +Cc: Junio C Hamano, Jeff King, git

Hi,

On Tue, 28 Nov 2017, Takuto Ikuta wrote:

> As long as this PR is included in next Git for Windows release, I
> won't suffer from slow git fetch.
> https://github.com/git-for-windows/git/pull/1372
> 
> But I sent you 2 PRs to follow right way.
> https://github.com/git-for-windows/git/pull/1379
> https://github.com/git-for-windows/git/pull/1380
> Feel free to merge these PRs.

I amended them slightly, and merged them.

Thank you,
Dscho

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack
  2017-11-28 11:27                 ` Johannes Schindelin
@ 2017-11-28 11:35                   ` Takuto Ikuta
  0 siblings, 0 replies; 12+ messages in thread
From: Takuto Ikuta @ 2017-11-28 11:35 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, Jeff King, git

Hi,

Thank you for merging!

Takuto

2017-11-28 20:27 GMT+09:00 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> Hi,
>
> On Tue, 28 Nov 2017, Takuto Ikuta wrote:
>
>> As long as this PR is included in next Git for Windows release, I
>> won't suffer from slow git fetch.
>> https://github.com/git-for-windows/git/pull/1372
>>
>> But I sent you 2 PRs to follow right way.
>> https://github.com/git-for-windows/git/pull/1379
>> https://github.com/git-for-windows/git/pull/1380
>> Feel free to merge these PRs.
>
> I amended them slightly, and merged them.
>
> Thank you,
> Dscho



-- 
Takuto Ikuta
Software Engineer in Tokyo
Chrome Infrastructure (goma team)

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-11-28 11:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27  4:27 [PATCH] Use OBJECT_INFO_QUICK to speedup git fetch-pack Takuto Ikuta
2017-11-27  4:35 ` Junio C Hamano
2017-11-27  4:37   ` Jeff King
2017-11-27  4:53     ` Junio C Hamano
2017-11-27  5:01       ` Takuto Ikuta
2017-11-27 21:24         ` Johannes Schindelin
2017-11-27 23:52           ` Junio C Hamano
2017-11-28  0:33             ` Johannes Schindelin
2017-11-28  1:58               ` Takuto Ikuta
2017-11-28 11:27                 ` Johannes Schindelin
2017-11-28 11:35                   ` Takuto Ikuta
2017-11-27  5:04       ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).