Patchwork revset: use parentsets.min in _children

login
register
mail settings
Submitter Pierre-Yves David
Date June 13, 2015, 1:38 a.m.
Message ID <708933d38cfe3a0df239.1434159496@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9625/
State Accepted
Headers show

Comments

Pierre-Yves David - June 13, 2015, 1:38 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1434074544 25200
#      Thu Jun 11 19:02:24 2015 -0700
# Node ID 708933d38cfe3a0df239e1ec0a6dfff5f7424cc4
# Parent  4388714b846e21cb2fefb686220c7c0d2df1b85a
revset: use parentsets.min in _children

As stated in the comment, using the smartset 'min' will give more opportunity to
be smart. It give a small but significant boost to the performance. Most of the
time is still spend doing the actual computation but at least we can scrap some
performance when it makes sense.

revset #0: roots(0:tip)
   plain
0) 0.046600
1) 0.044109  94%
Matt Mackall - June 15, 2015, 5:36 p.m.
On Fri, 2015-06-12 at 18:38 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1434074544 25200
> #      Thu Jun 11 19:02:24 2015 -0700
> # Node ID 708933d38cfe3a0df239e1ec0a6dfff5f7424cc4
> # Parent  4388714b846e21cb2fefb686220c7c0d2df1b85a
> revset: use parentsets.min in _children

Queued for default, thanks.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -616,13 +616,11 @@  def checkstatus(repo, subset, pat, field
 def _children(repo, narrow, parentset):
     if not parentset:
         return baseset()
     cs = set()
     pr = repo.changelog.parentrevs
-    # XXX this should be 'parentset.min()' assuming 'parentset' is a smartset
-    # (and if it is not, it should.)
-    minrev = min(parentset)
+    minrev = parentset.min()
     for r in narrow:
         if r <= minrev:
             continue
         for p in pr(r):
             if p in parentset: