Re: [PATCH 2/2] lookup_commit_reference_gently: do not read non-{tag,commit}

2013-05-31 Thread Jeff King
On Fri, May 31, 2013 at 10:08:06AM +0200, Thomas Rast wrote: > > Have you measured the impact of this on normal operations? During a > > traversal, we spend a measurable amount of time looking up commits in > > packfiles, and this would presumably double it. > > I don't think so, but admittedly I

Re: [PATCH 2/2] lookup_commit_reference_gently: do not read non-{tag,commit}

2013-05-31 Thread Thomas Rast
Ramkumar Ramachandra writes: > Thomas Rast wrote: >> + struct object *obj; >> + int type = sha1_object_info(sha1, NULL); >> + /* If it's neither tag nor commit, parsing the object is wasted >> effort */ >> + if (type != OBJ_TAG && type != OBJ_COMMIT) >> + re

Re: [PATCH 2/2] lookup_commit_reference_gently: do not read non-{tag,commit}

2013-05-31 Thread Thomas Rast
Jeff King writes: > On Thu, May 30, 2013 at 10:00:23PM +0200, Thomas Rast wrote: > >> lookup_commit_reference_gently unconditionally parses the object given >> to it. This slows down git-describe a lot if you have a repository >> with large tagged blobs in it: parse_object() will read the entire

Re: [PATCH 2/2] lookup_commit_reference_gently: do not read non-{tag,commit}

2013-05-30 Thread Ramkumar Ramachandra
Thomas Rast wrote: > diff --git a/commit.c b/commit.c > index 888e02a..00e8d4a 100644 > --- a/commit.c > +++ b/commit.c > @@ -31,8 +31,12 @@ static struct commit *check_commit(struct object *obj, > struct commit *lookup_commit_reference_gently(const unsigned char *sha1, >

Re: [PATCH 2/2] lookup_commit_reference_gently: do not read non-{tag,commit}

2013-05-30 Thread Duy Nguyen
On Fri, May 31, 2013 at 4:22 AM, Jeff King wrote: > On Thu, May 30, 2013 at 10:00:23PM +0200, Thomas Rast wrote: > >> lookup_commit_reference_gently unconditionally parses the object given >> to it. This slows down git-describe a lot if you have a repository >> with large tagged blobs in it: pars

Re: [PATCH 2/2] lookup_commit_reference_gently: do not read non-{tag,commit}

2013-05-30 Thread Jeff King
On Thu, May 30, 2013 at 10:00:23PM +0200, Thomas Rast wrote: > lookup_commit_reference_gently unconditionally parses the object given > to it. This slows down git-describe a lot if you have a repository > with large tagged blobs in it: parse_object() will read the entire > blob and verify that it

[PATCH 2/2] lookup_commit_reference_gently: do not read non-{tag,commit}

2013-05-30 Thread Thomas Rast
lookup_commit_reference_gently unconditionally parses the object given to it. This slows down git-describe a lot if you have a repository with large tagged blobs in it: parse_object() will read the entire blob and verify that its sha1 matches, only to then throw it away. Speed it up by checking t