Patchwork [4,of,4] files: cache repo.dirstate

login
register
mail settings
Submitter Siddharth Agarwal
Date Sept. 30, 2014, 11:08 p.m.
Message ID <927bc353a55e1e92d7af.1412118502@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/6053/
State Accepted
Headers show

Comments

Siddharth Agarwal - Sept. 30, 2014, 11:08 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1412118079 25200
#      Tue Sep 30 16:01:19 2014 -0700
# Node ID 927bc353a55e1e92d7af429ba850b6d279a5998b
# Parent  7a1f88d04efc612c8070ac0d7c59d8b33c37d438
files: cache repo.dirstate

For a large repo, 'hg files' goes from 2.27 seconds to 1.92.
Matt Mackall - Sept. 30, 2014, 11:32 p.m.
On Tue, 2014-09-30 at 16:08 -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1412118079 25200
> #      Tue Sep 30 16:01:19 2014 -0700
> # Node ID 927bc353a55e1e92d7af429ba850b6d279a5998b
> # Parent  7a1f88d04efc612c8070ac0d7c59d8b33c37d438
> files: cache repo.dirstate

Very nice, queued for default.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3219,8 +3219,9 @@ 
     fmt = '%s' + end
 
     m = scmutil.match(ctx, pats, opts)
+    ds = repo.dirstate
     for f in ctx.matches(m):
-        if rev is None and repo.dirstate[f] == 'r':
+        if rev is None and ds[f] == 'r':
             continue
         fm.startitem()
         if ui.verbose: