From d762011c4b09e0a97bc610eddd5d89eb34dcbc7c Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sun, 1 May 2011 20:55:38 -0700 Subject: [PATCH] Speed up a common case in iostream._merge_prefix --- tornado/iostream.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tornado/iostream.py b/tornado/iostream.py index 02016a0f3..01df80544 100644 --- a/tornado/iostream.py +++ b/tornado/iostream.py @@ -516,6 +516,8 @@ def _merge_prefix(deque, size): >>> _merge_prefix(d, 100); print d deque(['abcdefghij']) """ + if len(deque) == 1 and len(deque[0]) < size: + return prefix = [] remaining = size while deque and remaining > 0: -- 2.47.2