dirstate: speed up inner loop of read.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Mon, 12 Jun 2006 09:36:23 -0700
changeset 2425 be2fd6398d50
parent 2422 6aa75e77cafe
child 2426 fb942bc15ef9
dirstate: speed up inner loop of read.
mercurial/dirstate.py
--- 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()