From: antirez Date: Fri, 15 Apr 2011 16:08:24 +0000 (+0200) Subject: addReplyLongLong optimized to return shared objects when the value to reply is 0... X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/009db6764504746d64fef7e6ccf661f7882bd72e?ds=inline addReplyLongLong optimized to return shared objects when the value to reply is 0 or 1 --- diff --git a/src/networking.c b/src/networking.c index 32c06306..c8a39ba5 100644 --- a/src/networking.c +++ b/src/networking.c @@ -321,7 +321,12 @@ void _addReplyLongLong(redisClient *c, long long ll, char prefix) { } void addReplyLongLong(redisClient *c, long long ll) { - _addReplyLongLong(c,ll,':'); + if (ll == 0) + addReply(c,shared.czero); + else if (ll == 1) + addReply(c,shared.cone); + else + _addReplyLongLong(c,ll,':'); } void addReplyMultiBulkLen(redisClient *c, long length) {