revlog: add cache priming for reconstructing delta chains
authorMatt Mackall <mpm@selenic.com>
Thu, 07 May 2009 19:39:45 -0500
changeset 8318 6b8513f8274a
parent 8317 5cdf4067857a
child 8326 b7017097a4ec
revlog: add cache priming for reconstructing delta chains
mercurial/revlog.py
--- a/mercurial/revlog.py	Thu May 07 19:39:45 2009 -0500
+++ b/mercurial/revlog.py	Thu May 07 19:39:45 2009 -0500
@@ -949,6 +949,14 @@
 
         return self._loadchunk(offset, length, df)
 
+    def _prime(self, startrev, endrev, df):
+        start = self.start(startrev)
+        end = self.end(endrev)
+        if self._inline:
+            start += (startrev + 1) * self._io.size
+            end += (startrev + 1) * self._io.size
+        self._loadchunk(start, end - start, df)
+
     def chunk(self, rev, df=None):
         start, length = self.start(rev), self.length(rev)
         if self._inline:
@@ -989,10 +997,12 @@
             self._loadindex(base, rev + 1)
             if not self._inline and rev > base + 1:
                 df = self.opener(self.datafile)
+                self._prime(base, rev, df)
         else:
             self._loadindex(base, rev + 1)
             if not self._inline and rev > base:
                 df = self.opener(self.datafile)
+                self._prime(base, rev, df)
             text = self.chunk(base, df=df)
 
         bins = [self.chunk(r, df) for r in xrange(base + 1, rev + 1)]