mercurial/hgweb/protocol.py
changeset 29792 58467204cac0
parent 29788 b1809f5d7630
child 30014 d34cf260d15b
--- a/mercurial/hgweb/protocol.py	Sun Aug 14 17:07:05 2016 +0900
+++ b/mercurial/hgweb/protocol.py	Sun Aug 14 21:29:46 2016 -0700
@@ -79,10 +79,14 @@
         # the server's network or CPU.
         z = zlib.compressobj(self.ui.configint('server', 'zliblevel', -1))
         while True:
-            chunk = cg.read(4096)
+            chunk = cg.read(32768)
             if not chunk:
                 break
-            yield z.compress(chunk)
+            data = z.compress(chunk)
+            # Not all calls to compress() emit data. It is cheaper to inspect
+            # that here than to send it via the generator.
+            if data:
+                yield data
         yield z.flush()
     def _client(self):
         return 'remote:%s:%s:%s' % (