We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7eb371f commit 952eb9fCopy full SHA for 952eb9f
msgpack/fallback.py
@@ -252,11 +252,15 @@ def _fb_get_extradata(self):
252
253
def _fb_read(self, n, write_bytes=None):
254
buffs = self._fb_buffers
255
+ # We have a redundant codepath for the most common case, such that
256
+ # pypy optimizes it properly. This is the case that the read fits
257
+ # in the current buffer.
258
if (write_bytes is None and self._fb_buf_i < len(buffs) and
259
self._fb_buf_o + n < len(buffs[self._fb_buf_i])):
260
self._fb_buf_o += n
261
return buffs[self._fb_buf_i][self._fb_buf_o - n:self._fb_buf_o]
262
263
+ # The remaining cases.
264
ret = b''
265
while len(ret) != n:
266
if self._fb_buf_i == len(buffs):
0 commit comments