]> git.ipfire.org Git - thirdparty/tornado.git/commit
Increase performance of IOStream.read_until and read_until_regex.
authorBen Darnell <ben@bendarnell.com>
Mon, 26 Mar 2012 00:12:00 +0000 (17:12 -0700)
committerBen Darnell <ben@bendarnell.com>
Mon, 26 Mar 2012 00:12:00 +0000 (17:12 -0700)
commit41463a9851ab0bdfda2f21fdf3847673a223e1c4
tree4820e3063cc9cbc9d8f31076d885790cf0bdd489
parentc86b8ce005480ca7c7680ba5aa2d95127020b05d
Increase performance of IOStream.read_until and read_until_regex.

_handle_read and _try_inline_read now only call _read_from_buffer
once, after calling _read_to_buffer as many times as they can.  This
allows the progressive _double_prefix calls in _read_from_buffer to
work as efficiently as possible.

In testing with a 4MB read, performance improved by a factor of 32 (8
seconds to 0.25 seconds)
tornado/iostream.py
tornado/test/iostream_test.py