comparison hgext/largefiles/proto.py @ 30181:7356e6b1f5b8

util: increase filechunkiter size to 128k util.filechunkiter has been using a chunk size of 64k for more than 10 years, also in years where Moore's law still was a law. It is probably ok to bump it now and perhaps get a slight win in some cases. Also, largefiles have been using 128k for a long time. Specifying that size multiple times (or forgetting to do it) seems a bit stupid. Decreasing it to 64k also seems unfortunate. Thus, we will set the default chunksize to 128k and use the default everywhere.
author Mads Kiilerich <madski@unity3d.com>
date Fri, 14 Oct 2016 01:53:15 +0200
parents 29139be0ccc7
children 2add671bf55b
comparison
equal deleted inserted replaced
30180:736f92c44656 30181:7356e6b1f5b8
132 except ValueError: 132 except ValueError:
133 self._abort(error.ResponseError(_("unexpected response:"), 133 self._abort(error.ResponseError(_("unexpected response:"),
134 length)) 134 length))
135 135
136 # SSH streams will block if reading more than length 136 # SSH streams will block if reading more than length
137 for chunk in util.filechunkiter(stream, 128 * 1024, length): 137 for chunk in util.filechunkiter(stream, limit=length):
138 yield chunk 138 yield chunk
139 # HTTP streams must hit the end to process the last empty 139 # HTTP streams must hit the end to process the last empty
140 # chunk of Chunked-Encoding so the connection can be reused. 140 # chunk of Chunked-Encoding so the connection can be reused.
141 if issubclass(self.__class__, httppeer.httppeer): 141 if issubclass(self.__class__, httppeer.httppeer):
142 chunk = stream.read(1) 142 chunk = stream.read(1)