[PATCH] namespace: fastpath name lookup on invalid name

Feld Boris boris.feld at octobus.net
Mon Feb 26 05:47:21 EST 2018



On 24/02/2018 06:03, Yuya Nishihara wrote:
> On Thu, 22 Feb 2018 20:33:36 +0100, Boris Feld wrote:
>> # HG changeset patch
>> # User Boris Feld <boris.feld at octobus.net>
>> # Date 1519313522 -3600
>> #      Thu Feb 22 16:32:02 2018 +0100
>> # Node ID b65a85952c09cf4c71a1458fbc4ec77c49683314
>> # Parent  428de1a59f2df3d6d07ff1d7164c8ee56cbb7825
>> # EXP-Topic noname
>> # Available At https://bitbucket.org/octobus/mercurial-devel/
>> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b65a85952c09
>> namespace: fastpath name lookup on invalid name
>>
>> Since label cannot contains leading or trailing whitespace we can skip looking
>> for them. This is useful in repositories with slow labels (eg: special type of
>> tags). Short command running on a specific revision can benefit from such
>> shortcut.
>>
>> eg on a repository where loading tags take 0.4s:
>>
>> 1: hg log --template '{node}\n' --rev 'rev(0)'
>>     0.560 seconds
>>
>> 2: hg log --template '{node}\n' --rev ' rev(0)'
>>     0.109 seconds
>>
>> The changeset introduce a generic way to do such fast-pathing to help
>> extensions writer to apply the same principle to their extensions.
> So is this basically the same as the previous version in that we have to
> suggest using a weird syntax (leading/trailing space) to get to the fast path?
>
> https://www.mercurial-scm.org/pipermail/mercurial-devel/2018-February/111432.html
Yes, it's a cleaner way to implement the first proposed implementation.

I just sent the email that I should have sent with this patch that 
proposes other potential solutions.
>> Instead, maybe we can make lookup() to not search slow labels assuming these
>> labeling schemes didn't exist in pre-revset era. Alternatively, we could add
>> a config knob to switch off the old-style range support.



More information about the Mercurial-devel mailing list