mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-23 22:03:18 +00:00
fallback: _fb_read: add fast-path
This commit is contained in:
parent
d91a0d3d68
commit
4cde7f080c
1 changed files with 5 additions and 0 deletions
|
|
@ -222,6 +222,11 @@ class Unpacker(object):
|
|||
return ''.join(bufs)
|
||||
|
||||
def _fb_read(self, n, write_bytes=None):
|
||||
if (write_bytes is None and self._fb_buf_i < len(self._fb_buffers)
|
||||
and self._fb_buf_o + n < len(self._fb_buffers[self._fb_buf_i])):
|
||||
self._fb_buf_o += n
|
||||
return self._fb_buffers[self._fb_buf_i][
|
||||
self._fb_buf_o-n:self._fb_buf_o]
|
||||
ret = ''
|
||||
while len(ret) != n:
|
||||
if self._fb_buf_i == len(self._fb_buffers):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue