Patchwork [V2] manifest: improve filesnotin performance by using lazymanifest diff

login
register
mail settings
Submitter Tony Tung
Date May 2, 2016, 10:22 p.m.
Message ID <3f2371203ed9ce54fe8a.1462227775@andromeda.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/14859/
State Accepted
Headers show

Comments

Tony Tung - May 2, 2016, 10:22 p.m.
# HG changeset patch
# User Tony Tung <tonytung@merly.org>
# Date 1462227736 25200
#      Mon May 02 15:22:16 2016 -0700
# Branch stable
# Node ID 3f2371203ed9ce54fe8a0f0f922daafe817424c9
# Parent  61463b8fcef871ff3efff53945df4671c71c4e31
manifest: improve filesnotin performance by using lazymanifest diff

lazymanifests can compute diffs significantly faster than taking the set
of two manifests and calculating the delta.

when running hg diff --git -c . on Facebook's big repo, this reduces the
run time from 2.1s to 1.5s.
Matt Mackall - May 3, 2016, 3:42 p.m.
On Mon, 2016-05-02 at 15:22 -0700, Tony Tung wrote:
> # HG changeset patch
> # User Tony Tung <tonytung@merly.org>
> # Date 1462227736 25200
> #      Mon May 02 15:22:16 2016 -0700
> # Branch stable
> # Node ID 3f2371203ed9ce54fe8a0f0f922daafe817424c9
> # Parent  61463b8fcef871ff3efff53945df4671c71c4e31
> manifest: improve filesnotin performance by using lazymanifest diff

Queued for default, thanks.

-- 
Mathematics is the supreme nostalgia of our time.

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -211,8 +211,10 @@ 
 
     def filesnotin(self, m2):
         '''Set of files in this manifest that are not in the other'''
-        files = set(self)
-        files.difference_update(m2)
+        diff = self.diff(m2)
+        files = set(filepath
+                    for filepath, hashflags in diff.iteritems()
+                    if hashflags[1][0] is None)
         return files
 
     @propertycache