Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/revlog.py @ 5448:e038738714fd
revlog: avoid large yields in group()
Split large yields so that the downstream consumer (chunkbuffer) will avoid
some pain when reading ahead.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 11 Oct 2007 00:46:51 -0500 |
parents | 64cf1c853674 |
children | c728424d44c6 |
comparison
equal
deleted
inserted
replaced
5447:56591846f819 | 5448:e038738714fd |
---|---|
1094 meta += mdiff.trivialdiffheader(len(d)) | 1094 meta += mdiff.trivialdiffheader(len(d)) |
1095 else: | 1095 else: |
1096 d = self.revdiff(a, b) | 1096 d = self.revdiff(a, b) |
1097 yield changegroup.chunkheader(len(meta) + len(d)) | 1097 yield changegroup.chunkheader(len(meta) + len(d)) |
1098 yield meta | 1098 yield meta |
1099 yield d | 1099 if len(d) > 2**20: |
1100 pos = 0 | |
1101 while pos < len(d): | |
1102 pos2 = pos + 2 ** 18 | |
1103 yield d[pos:pos2] | |
1104 pos = pos2 | |
1105 else: | |
1106 yield d | |
1100 | 1107 |
1101 yield changegroup.closechunk() | 1108 yield changegroup.closechunk() |
1102 | 1109 |
1103 def addgroup(self, revs, linkmapper, transaction, unique=0): | 1110 def addgroup(self, revs, linkmapper, transaction, unique=0): |
1104 """ | 1111 """ |