Use precomptued objects for bulk and mbulk prefixes.

This commit is contained in:
antirez 2013-08-12 12:43:26 +02:00
parent c06de115af
commit 7398930756

View File

@ -474,6 +474,9 @@ void addReplyLongLong(redisClient *c, long long ll) {
} }
void addReplyMultiBulkLen(redisClient *c, long length) { void addReplyMultiBulkLen(redisClient *c, long length) {
if (length < REDIS_SHARED_BULKHDR_LEN)
addReply(c,shared.mbulkhdr[length]);
else
addReplyLongLongWithPrefix(c,length,'*'); addReplyLongLongWithPrefix(c,length,'*');
} }
@ -496,6 +499,10 @@ void addReplyBulkLen(redisClient *c, robj *obj) {
len++; len++;
} }
} }
if (len < REDIS_SHARED_BULKHDR_LEN)
addReply(c,shared.bulkhdr[len]);
else
addReplyLongLongWithPrefix(c,len,'$'); addReplyLongLongWithPrefix(c,len,'$');
} }