changeset 2425:be2fd6398d50

dirstate: speed up inner loop of read.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Mon, 12 Jun 2006 09:36:23 -0700
parents 6aa75e77cafe
children fb942bc15ef9
files mercurial/dirstate.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Fri Jun 09 12:05:17 2006 -0700
+++ b/mercurial/dirstate.py	Mon Jun 12 09:36:23 2006 -0700
@@ -168,15 +168,17 @@
         pos = 40
         e_size = struct.calcsize(self.format)
         while pos < len(st):
-            e = struct.unpack(self.format, st[pos:pos+e_size])
+            newpos = pos + e_size
+            e = struct.unpack(self.format, st[pos:newpos])
             l = e[4]
-            pos += e_size
-            f = st[pos:pos + l]
+            pos = newpos
+            newpos = pos + l
+            f = st[pos:newpos]
             if '\0' in f:
                 f, c = f.split('\0')
                 self.copies[f] = c
             self.map[f] = e[:4]
-            pos += l
+            pos = newpos
 
     def copy(self, source, dest):
         self.lazyread()