summaryrefslogtreecommitdiff
path: root/src/networking.c
diff options
context:
space:
mode:
authorfilipe oliveira <filipecosta.90@gmail.com>2022-08-04 08:38:20 +0100
committerGitHub <noreply@github.com>2022-08-04 10:38:20 +0300
commit6686c6d774fcf71fffbaeff798c997ab3eff80de (patch)
tree4aed8229c8298f520780ce51d105450006f8e1e0 /src/networking.c
parentf3588fbcca1eb339324c72ff78b4643420fd020a (diff)
downloadredis-6686c6d774fcf71fffbaeff798c997ab3eff80de.tar.gz
Avoid the sdslen() on shared.crlf given we know its size beforehand. Improve ~3-4% of cpu cycles to lrange logic (#10987)
* Avoid the sdslen() on shared.crlf given we know its size beforehand * Removed shared.crlf from sharedObjects
Diffstat (limited to 'src/networking.c')
-rw-r--r--src/networking.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/networking.c b/src/networking.c
index 8e68300c2..6bf39d11a 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -860,7 +860,7 @@ void addReplyBigNum(client *c, const char* num, size_t len) {
} else {
addReplyProto(c,"(",1);
addReplyProto(c,num,len);
- addReply(c,shared.crlf);
+ addReplyProto(c,"\r\n",2);
}
}
@@ -991,21 +991,21 @@ void addReplyBulkLen(client *c, robj *obj) {
void addReplyBulk(client *c, robj *obj) {
addReplyBulkLen(c,obj);
addReply(c,obj);
- addReply(c,shared.crlf);
+ addReplyProto(c,"\r\n",2);
}
/* Add a C buffer as bulk reply */
void addReplyBulkCBuffer(client *c, const void *p, size_t len) {
addReplyLongLongWithPrefix(c,len,'$');
addReplyProto(c,p,len);
- addReply(c,shared.crlf);
+ addReplyProto(c,"\r\n",2);
}
/* Add sds to reply (takes ownership of sds and frees it) */
void addReplyBulkSds(client *c, sds s) {
addReplyLongLongWithPrefix(c,sdslen(s),'$');
addReplySds(c,s);
- addReply(c,shared.crlf);
+ addReplyProto(c,"\r\n",2);
}
/* Set sds to a deferred reply (for symmetry with addReplyBulkSds it also frees the sds) */