Skip to content

Commit

Permalink
Speed up a common case in iostream._merge_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarnell committed May 2, 2011
1 parent 3cc7f2c commit d762011
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tornado/iostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d762011

Please sign in to comment.