Re: [PATCH v3 3/5] sha1_name: Unroll len loop in find_unique_abbrev_r

2017-10-05 Thread Junio C Hamano
Jeff King writes: > So I think on the generating side we are better off creating a slightly > longer abbreviation that is unambiguous no matter what context it is > used in. I.e., I'd argue that it's actually more _correct_ to ignore > the disambiguation code entirely on the

Re: [PATCH v3 3/5] sha1_name: Unroll len loop in find_unique_abbrev_r

2017-10-05 Thread Jeff King
On Wed, Oct 04, 2017 at 03:07:25PM +0900, Junio C Hamano wrote: > > - exists = has_sha1_file(sha1); > > - while (len < GIT_SHA1_HEXSZ) { > > - struct object_id oid_ret; > > - status = get_short_oid(hex, len, _ret, GET_OID_QUIETLY); > > - if (exists > > -

Re: [PATCH v3 3/5] sha1_name: Unroll len loop in find_unique_abbrev_r

2017-10-04 Thread Junio C Hamano
Derrick Stolee writes: > On 10/4/2017 2:07 AM, Junio C Hamano wrote: >> Derrick Stolee writes: >> >>> - exists = has_sha1_file(sha1); >>> - while (len < GIT_SHA1_HEXSZ) { >>> - struct object_id oid_ret; >>> - status =

Re: [PATCH v3 3/5] sha1_name: Unroll len loop in find_unique_abbrev_r

2017-10-04 Thread Derrick Stolee
On 10/4/2017 2:07 AM, Junio C Hamano wrote: Derrick Stolee writes: - exists = has_sha1_file(sha1); - while (len < GIT_SHA1_HEXSZ) { - struct object_id oid_ret; - status = get_short_oid(hex, len, _ret, GET_OID_QUIETLY); -

Re: [PATCH v3 3/5] sha1_name: Unroll len loop in find_unique_abbrev_r

2017-10-04 Thread Derrick Stolee
On 10/4/2017 2:10 AM, Junio C Hamano wrote: Derrick Stolee writes: ... I understand that this patch on its own does not have good numbers. I split the patches 3 and 4 specifically to highlight two distinct changes: Patch 3: Unroll the len loop that may inspect all files

Re: [PATCH v3 3/5] sha1_name: Unroll len loop in find_unique_abbrev_r

2017-10-04 Thread Junio C Hamano
Derrick Stolee writes: > On 10/3/2017 6:49 AM, Junio C Hamano wrote: >> Derrick Stolee writes: >> >>> p0008.1: find_unique_abbrev() for existing objects >>> -- >>> >>> For 10 repeated tests, each checking

Re: [PATCH v3 3/5] sha1_name: Unroll len loop in find_unique_abbrev_r

2017-10-04 Thread Junio C Hamano
Derrick Stolee writes: > -int find_unique_abbrev_r(char *hex, const unsigned char *sha1, int len) > +struct min_abbrev_data { > + unsigned int init_len; > + unsigned int cur_len; > + char *hex; > +}; > + > +static int extend_abbrev_len(const struct object_id

Re: [PATCH v3 3/5] sha1_name: Unroll len loop in find_unique_abbrev_r

2017-10-03 Thread Derrick Stolee
On 10/3/2017 6:49 AM, Junio C Hamano wrote: Derrick Stolee writes: p0008.1: find_unique_abbrev() for existing objects -- For 10 repeated tests, each checking 100,000 known objects, we find the following results when

Re: [PATCH v3 3/5] sha1_name: Unroll len loop in find_unique_abbrev_r

2017-10-03 Thread Junio C Hamano
Derrick Stolee writes: > p0008.1: find_unique_abbrev() for existing objects > -- > > For 10 repeated tests, each checking 100,000 known objects, we find the > following results when running in a Linux VM: > > | | Pack

[PATCH v3 3/5] sha1_name: Unroll len loop in find_unique_abbrev_r

2017-10-02 Thread Derrick Stolee
Unroll the while loop inside find_unique_abbrev_r to avoid iterating through all loose objects and packfiles multiple times when the short name is longer than the predicted length. Instead, inspect each object that collides with the estimated abbreviation to find the longest common prefix.