Patchwork [4,of,4] revset: added lazyset implementation to author revset

login
register
mail settings
Submitter Lucas Moscovicz
Date Feb. 11, 2014, 6:50 p.m.
Message ID <9bca7c192a62d916e3a9.1392144653@dev1037.prn2.facebook.com>
Download mbox | patch
Permalink /patch/3571/
State Accepted
Commit 92f6f2db3cf475e7a1f20f7e1a78cf41b49985b5
Headers show

Comments

Matt Mackall - Feb. 11, 2014, 5:47 p.m.
On Tue, 2014-02-11 at 10:50 -0800, Lucas Moscovicz wrote:
> # HG changeset patch
> # User Lucas Moscovicz <lmoscovicz@fb.com>
> # Date 1391016151 28800
> #      Wed Jan 29 09:22:31 2014 -0800
> # Node ID 9bca7c192a62d916e3a91cc305db9d7594ffcb03
> # Parent  9e46d74473bc918341572a5b94737a20b56e01b1
> revset: added lazyset implementation to author revset
> 
> Performance benchmarking:
> 
> $ time hg log -qr "first(author(mpm))"
> 0:9117c6561b0b
> 
> real  0m3.486s
> user  0m3.317s
> sys 0m0.077s
> 
> $ time ./hg log -qr "first(author(mpm))"
> 0:9117c6561b0b
> 
> real  0m0.551s
> user  0m0.295s
> sys 0m0.072s

These are queued for default, thanks.
Lucas Moscovicz - Feb. 11, 2014, 6:50 p.m.
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz@fb.com>
# Date 1391016151 28800
#      Wed Jan 29 09:22:31 2014 -0800
# Node ID 9bca7c192a62d916e3a91cc305db9d7594ffcb03
# Parent  9e46d74473bc918341572a5b94737a20b56e01b1
revset: added lazyset implementation to author revset

Performance benchmarking:

$ time hg log -qr "first(author(mpm))"
0:9117c6561b0b

real  0m3.486s
user  0m3.317s
sys 0m0.077s

$ time ./hg log -qr "first(author(mpm))"
0:9117c6561b0b

real  0m0.551s
user  0m0.295s
sys 0m0.072s

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -347,8 +347,7 @@ 
     # i18n: "author" is a keyword
     n = encoding.lower(getstring(x, _("author requires a string")))
     kind, pattern, matcher = _substringmatcher(n)
-    return baseset([r for r in subset if
-        matcher(encoding.lower(repo[r].user()))])
+    return lazyset(subset, lambda x: matcher(encoding.lower(repo[x].user())))
 
 def bisect(repo, subset, x):
     """``bisect(string)``