diff -r 28591876fa63 -r 58467204cac0 mercurial/hgweb/protocol.py --- 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' % (