Patchwork [evolve-ext] directaccess: don't try to partialmatch '.'

login
register
mail settings
Submitter Siddharth Agarwal
Date Aug. 12, 2015, 11:08 p.m.
Message ID <6884c640f67892bbebb5.1439420905@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/10197/
State Changes Requested
Headers show

Comments

Siddharth Agarwal - Aug. 12, 2015, 11:08 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1439420885 25200
#      Wed Aug 12 16:08:05 2015 -0700
# Node ID 6884c640f67892bbebb5538cbbcda88f8927588f
# Parent  3dec62fc266eff7c7aa20e3229ffbede1c33d208
directaccess: don't try to partialmatch '.'

Trying to partialmatch '.' turns out to be (a) pointless and (b) extremely
slow. On a repo with a million commits, with directaccess enabled,

hg log -r .^::.

goes from 2.1 seconds to 0.5.
Pierre-Yves David - Aug. 12, 2015, 11:38 p.m.
On 08/12/2015 04:08 PM, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1439420885 25200
> #      Wed Aug 12 16:08:05 2015 -0700
> # Node ID 6884c640f67892bbebb5538cbbcda88f8927588f
> # Parent  3dec62fc266eff7c7aa20e3229ffbede1c33d208
> directaccess: don't try to partialmatch '.'
>
> Trying to partialmatch '.' turns out to be (a) pointless and (b) extremely
> slow. On a repo with a million commits, with directaccess enabled,
>
> hg log -r .^::.
>
> goes from 2.1 seconds to 0.5.

Should be just not try partial match on anything that is not a valid hex?
Siddharth Agarwal - Aug. 12, 2015, 11:45 p.m.
On 8/12/15 4:38 PM, Pierre-Yves David wrote:
>
>
> On 08/12/2015 04:08 PM, Siddharth Agarwal wrote:
>> # HG changeset patch
>> # User Siddharth Agarwal <sid0@fb.com>
>> # Date 1439420885 25200
>> #      Wed Aug 12 16:08:05 2015 -0700
>> # Node ID 6884c640f67892bbebb5538cbbcda88f8927588f
>> # Parent  3dec62fc266eff7c7aa20e3229ffbede1c33d208
>> directaccess: don't try to partialmatch '.'
>>
>> Trying to partialmatch '.' turns out to be (a) pointless and (b) 
>> extremely
>> slow. On a repo with a million commits, with directaccess enabled,
>>
>> hg log -r .^::.
>>
>> goes from 2.1 seconds to 0.5.
>
> Should be just not try partial match on anything that is not a valid hex?

Hmmm, quite possibly.

Patch

diff --git a/hgext/directaccess.py b/hgext/directaccess.py
--- a/hgext/directaccess.py
+++ b/hgext/directaccess.py
@@ -157,6 +157,9 @@  def _posttreebuilthook(orig, tree, repo)
         repo.symbols = gethashsymbols(tree)
         cl = repo.unfiltered().changelog
         for node in repo.symbols:
+            # don't try doing a partialmatch on known-visible revisions
+            if node == '.':
+                continue
             try:
                 node = cl._partialmatch(node)
             except error.LookupError: