Patchwork [remotenames,V3] remotenames: remove support for old remotenames file format

login
register
mail settings
Submitter Tony Tung
Date July 21, 2016, 5:57 a.m.
Message ID <a216bfe47256fa157f7b.1469080661@andromeda.local>
Download mbox | patch
Permalink /patch/15965/
State Accepted
Headers show

Comments

Tony Tung - July 21, 2016, 5:57 a.m.
# HG changeset patch
# User Tony Tung <tonytung@merly.org>
# Date 1469080576 25200
#      Wed Jul 20 22:56:16 2016 -0700
# Node ID a216bfe47256fa157f7bc1fb80e10d91918f95b6
# Parent  183d5b47f7472b839a96e7be735bb7fbf8068969
remotenames: remove support for old remotenames file format

This can cost up to 100ms when we don't need it on startup time.

Things that I've based this number on: 5 runs each of hg status, hg bookmark.
Jun Wu - July 21, 2016, 11:54 a.m.
I love this 100ms speed-up. If we want to support the old format, I think it
is doable by making "branches" lazy and testing "if rname in bookmarks"
first. Alternatively, we may want to find a way to disable "branches"
more completely.

I prefer dropping support. Will let smf decide.


Excerpts from ttung's message of 2016-07-20 22:57:41 -0700:
> # HG changeset patch
> # User Tony Tung <tonytung@merly.org>
> # Date 1469080576 25200
> #      Wed Jul 20 22:56:16 2016 -0700
> # Node ID a216bfe47256fa157f7bc1fb80e10d91918f95b6
> # Parent  183d5b47f7472b839a96e7be735bb7fbf8068969
> remotenames: remove support for old remotenames file format
> 
> This can cost up to 100ms when we don't need it on startup time.
> 
> Things that I've based this number on: 5 runs each of hg status, hg bookmark.
> 
> diff --git a/remotenames.py b/remotenames.py
> --- a/remotenames.py
> +++ b/remotenames.py
> @@ -1229,10 +1229,6 @@
>      if not vfs.exists('remotenames'):
>          return
>  
> -    # needed to heuristically determine if a file is in the old format
> -    branches = repo.names['branches'].listnames(repo)
> -    bookmarks = repo.names['bookmarks'].listnames(repo)
> -
>      f = vfs('remotenames')
>      for line in f:
>          nametype = None
> @@ -1254,14 +1250,6 @@
>          if not rname:
>              continue
>  
> -        # old format didn't save the nametype, so check for the name in
> -        # branches and bookmarks
> -        if nametype is None:
> -            if rname in branches:
> -                nametype = 'branches'
> -            elif rname in bookmarks:
> -                nametype = 'bookmarks'
> -
>          yield node, nametype, remote, rname
>  
>      f.close()
Sean Farley - July 21, 2016, 6:14 p.m.
Jun Wu <quark@fb.com> writes:

> I love this 100ms speed-up. If we want to support the old format, I think it
> is doable by making "branches" lazy and testing "if rname in bookmarks"
> first. Alternatively, we may want to find a way to disable "branches"
> more completely.
>
> I prefer dropping support. Will let smf decide.

I'm fine with dropping support (this is a very experimental extension).
I'm still processing the journal patch so I'm behind on reviewing this
one.
Sean Farley - July 22, 2016, 7:53 p.m.
Sean Farley <sean@farley.io> writes:

> Jun Wu <quark@fb.com> writes:
>
>> I love this 100ms speed-up. If we want to support the old format, I think it
>> is doable by making "branches" lazy and testing "if rname in bookmarks"
>> first. Alternatively, we may want to find a way to disable "branches"
>> more completely.
>>
>> I prefer dropping support. Will let smf decide.
>
> I'm fine with dropping support (this is a very experimental extension).
> I'm still processing the journal patch so I'm behind on reviewing this
> one.

This is now pushed. Thanks!

Patch

diff --git a/remotenames.py b/remotenames.py
--- a/remotenames.py
+++ b/remotenames.py
@@ -1229,10 +1229,6 @@ 
     if not vfs.exists('remotenames'):
         return
 
-    # needed to heuristically determine if a file is in the old format
-    branches = repo.names['branches'].listnames(repo)
-    bookmarks = repo.names['bookmarks'].listnames(repo)
-
     f = vfs('remotenames')
     for line in f:
         nametype = None
@@ -1254,14 +1250,6 @@ 
         if not rname:
             continue
 
-        # old format didn't save the nametype, so check for the name in
-        # branches and bookmarks
-        if nametype is None:
-            if rname in branches:
-                nametype = 'branches'
-            elif rname in bookmarks:
-                nametype = 'bookmarks'
-
         yield node, nametype, remote, rname
 
     f.close()