Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed set_multi serialization performance

  • Loading branch information...
commit 5e43ab376f65e95a2d303fcb1e1f2910ee5c6d8b 1 parent f74f94e
@mquander mquander authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 memcache.py
View
7 memcache.py
@@ -589,7 +589,8 @@ def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0):
dead_servers = []
for server in server_keys.keys():
- bigcmd = bytes()
+ bigcmd = bytearray()
+ write = bigcmd.extend
try:
newline = "\r\n".encode('utf-8')
for key in server_keys[server]: # These are mangled keys
@@ -599,8 +600,8 @@ def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0):
cmd += store_info[2].encode('utf-8')
else:
cmd += store_info[2]
- bigcmd += cmd + newline
- server.send_cmds(bigcmd)
+ write(cmd + newline)
+ server.send_cmds(bytes(bigcmd))
except socket.error as msg:
if type(msg) is tuple: msg = msg[1]
server.mark_dead(msg)
Please sign in to comment.
Something went wrong with that request. Please try again.