Patchwork [2,of,4] revset: categorize wdir() as very fast function

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 5, 2017, 2:48 p.m.
Message ID <8464d3337540ccf9a2a4.1483627726@mimosa>
Download mbox | patch
Permalink /patch/18103/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 5, 2017, 2:48 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1471683023 -32400
#      Sat Aug 20 17:50:23 2016 +0900
# Node ID 8464d3337540ccf9a2a41108f470dff363e46947
# Parent  77cde77a8f4c9717e36b8b5d62b9518e68c1ac27
revset: categorize wdir() as very fast function

The cost of wdir() should be identical to or cheaper than _intlist().

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2606,7 +2606,7 @@  def _optimize(x, small):
             w = 100 # very slow
         elif f == "ancestor":
             w = 1 * smallbonus
-        elif f in ('reverse', 'limit', 'first', '_intlist'):
+        elif f in ('reverse', 'limit', 'first', 'wdir', '_intlist'):
             w = 0
         elif f == "sort":
             w = 10 # assume most sorts look at changelog