Patchwork [3,of,6] revlog._chunks: inline getchunk

login
register
mail settings
Submitter Siddharth Agarwal
Date Sept. 7, 2013, 8:40 p.m.
Message ID <8c9c2c14cdfb0dd708c5.1378586437@dev1091.prn1.facebook.com>
Download mbox | patch
Permalink /patch/2407/
State Accepted
Commit 1aab406be57c4a4bbe55dab1a6a49991956d2863
Headers show

Comments

Siddharth Agarwal - Sept. 7, 2013, 8:40 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1378533471 25200
#      Fri Sep 06 22:57:51 2013 -0700
# Node ID 8c9c2c14cdfb0dd708c5f2fdd793035b1f6c8466
# Parent  6d30cb54be060a26ce4a042be8ff43b88afc9829
revlog._chunks: inline getchunk

We do this in a somewhat hacky way, relying on the fact that our sole caller
preloads the cache right before calling us. An upcoming patch will make this
more sensible.

For a 20 MB manifest with a delta chain of > 40k, perfmanifest goes from 0.49
seconds to 0.46.

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -863,17 +863,20 @@ 
         length = self.length
         inline = self._inline
         iosize = self._io.size
-        getchunk = self._getchunk
+        buffer = util.buffer
 
         l = []
         ladd = l.append
 
+        # XXX assume for now that chunkcache is preloaded
+        offset, data = self._chunkcache
+
         for rev in revs:
             chunkstart = start(rev)
             if inline:
                 chunkstart += (rev + 1) * iosize
             chunklength = length(rev)
-            ladd(decompress(getchunk(chunkstart, chunklength)))
+            ladd(decompress(buffer(data, chunkstart - offset, chunklength)))
 
         return l