[Zodb-checkins] SVN: ZODB/trunk/src/ZEO/zrpc/smac.py Inlining a common case gives another 1% improvement in load CPU. Not
Jim Fulton
jim at zope.com
Tue Apr 5 18:09:02 EDT 2011
Log message for revision 121290:
Inlining a common case gives another 1% improvement in load CPU. Not
much, but I'll take it. :)
Changed:
U ZODB/trunk/src/ZEO/zrpc/smac.py
-=-
Modified: ZODB/trunk/src/ZEO/zrpc/smac.py
===================================================================
--- ZODB/trunk/src/ZEO/zrpc/smac.py 2011-04-05 20:57:16 UTC (rev 121289)
+++ ZODB/trunk/src/ZEO/zrpc/smac.py 2011-04-05 22:09:01 UTC (rev 121290)
@@ -266,7 +266,15 @@
while (size <= SEND_SIZE) and messages:
message = messages[0]
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:
del messages[:]
del output[:]
More information about the Zodb-checkins
mailing list