[PATCH] pathencode: skip encoding if input is already longer than maxstorepathlen

Adrian Buehlmann adrian at cadifra.com
Sun Sep 23 03:56:30 CDT 2012


On 2012-09-22 00:50, Adrian Buehlmann wrote:
> On 2012-09-21 23:04, Adrian Buehlmann wrote:
>> # HG changeset patch
>> # User Adrian Buehlmann <adrian at cadifra.com>
>> # Date 1348261363 -7200
>> # Node ID b532af187425e6ff650b5c112bf553b52ae4c560
>> # Parent  331d611813eca2098fdb75c741cb7f5cc72b6567
>> pathencode: skip encoding if input is already longer than maxstorepathlen
>>
>> Calling basicencode may make the path longer, never shorter. If it's already
>> too long before, then we don't even need to basicencode it.
>>
>> diff --git a/mercurial/pathencode.c b/mercurial/pathencode.c
>> --- a/mercurial/pathencode.c
>> +++ b/mercurial/pathencode.c
>> @@ -508,6 +508,12 @@
>>  		return NULL;
>>  	}
>>  
>> +	if (len > maxstorepathlen) {
> 
> For my Netbeans clone here, this "if" is true for 32798 of 120151
> entries of the fncache file (27% of the entries).

A total of 42209 of the 120151 entries in said fncache file need hashing
(35% of all entries).

So this "if" succeeds at correctly identifying 32798 (=78%) of the 42209
hashed path entries - at no cost (it uses information we already have in
local variables).




More information about the Mercurial-devel mailing list