Commit cd31bdd7 authored by Jim Fulton's avatar Jim Fulton

Inlining a common case gives another 1% improvement in load CPU. Not

much, but I'll take it. :)
parent 0fb31c06
...@@ -266,7 +266,15 @@ class SizedMessageAsyncConnection(asyncore.dispatcher): ...@@ -266,7 +266,15 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
while (size <= SEND_SIZE) and messages: while (size <= SEND_SIZE) and messages:
message = messages[0] message = messages[0]
if message.__class__ is str: if message.__class__ is str:
size += self.__message_output(messages.pop(0), output) if self.__hmac_send:
size += self.__message_output(messages.pop(0), output)
else:
# inline common case
lmessage = len(message)
output.append(struct.pack(">I", lmessage))
output.append(messages.pop())
size += 4 + lmessage
elif message is _close_marker: elif message is _close_marker:
del messages[:] del messages[:]
del output[:] del output[:]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment