comparison mercurial/revlog.py @ 19715:1aab406be57c

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.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 06 Sep 2013 22:57:51 -0700
parents 0e07c0b5fb1c
children e17976978ee4
comparison
equal deleted inserted replaced
19714:0e07c0b5fb1c 19715:1aab406be57c
861 Assumes that revs is in ascending order.''' 861 Assumes that revs is in ascending order.'''
862 start = self.start 862 start = self.start
863 length = self.length 863 length = self.length
864 inline = self._inline 864 inline = self._inline
865 iosize = self._io.size 865 iosize = self._io.size
866 getchunk = self._getchunk 866 buffer = util.buffer
867 867
868 l = [] 868 l = []
869 ladd = l.append 869 ladd = l.append
870
871 # XXX assume for now that chunkcache is preloaded
872 offset, data = self._chunkcache
870 873
871 for rev in revs: 874 for rev in revs:
872 chunkstart = start(rev) 875 chunkstart = start(rev)
873 if inline: 876 if inline:
874 chunkstart += (rev + 1) * iosize 877 chunkstart += (rev + 1) * iosize
875 chunklength = length(rev) 878 chunklength = length(rev)
876 ladd(decompress(getchunk(chunkstart, chunklength))) 879 ladd(decompress(buffer(data, chunkstart - offset, chunklength)))
877 880
878 return l 881 return l
879 882
880 def _chunkbase(self, rev): 883 def _chunkbase(self, rev):
881 return self._chunk(rev) 884 return self._chunk(rev)