changeset 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 56591846f819
children 17a4b20eda7b
files mercurial/revlog.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Thu Oct 11 00:46:49 2007 -0500
+++ b/mercurial/revlog.py	Thu Oct 11 00:46:51 2007 -0500
@@ -1096,7 +1096,14 @@
                 d = self.revdiff(a, b)
             yield changegroup.chunkheader(len(meta) + len(d))
             yield meta
-            yield d
+            if len(d) > 2**20:
+                pos = 0
+                while pos < len(d):
+                    pos2 = pos + 2 ** 18
+                    yield d[pos:pos2]
+                    pos = pos2
+            else:
+                yield d
 
         yield changegroup.closechunk()