summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2017-07-06 14:31:08 +0200
committerGitHub <noreply@github.com>2017-07-06 14:31:08 +0200
commit38dd30af4252a02ba504d677204a7e5066cef53f (patch)
treea8f48df9a4e4001daa4ab08a679025087dfa4cf1
parent2d5aa009595451bf8fc37520fa469cc09d485286 (diff)
parent10db81af71a6d4c4f99a59510939a2b4dc8f6864 (diff)
downloadredis-38dd30af4252a02ba504d677204a7e5066cef53f.tar.gz
Merge pull request #4105 from spinlock/unstable-networking
Optimize addReplyBulkSds for better performance
-rw-r--r--src/Makefile2
-rw-r--r--src/networking.c3
2 files changed, 2 insertions, 3 deletions
diff --git a/src/Makefile b/src/Makefile
index 24e960593..70574630a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -254,7 +254,7 @@ lcov:
@genhtml --legend -o lcov-html redis.info
test-sds: sds.c sds.h
- $(REDIS_CC) sds.c zmalloc.c -DSDS_TEST_MAIN -o /tmp/sds_test
+ $(REDIS_CC) sds.c zmalloc.c -DSDS_TEST_MAIN $(FINAL_LIBS) -o /tmp/sds_test
/tmp/sds_test
.PHONY: lcov
diff --git a/src/networking.c b/src/networking.c
index 27006514d..98e779642 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -561,8 +561,7 @@ void addReplyBulkCBuffer(client *c, const void *p, size_t len) {
/* Add sds to reply (takes ownership of sds and frees it) */
void addReplyBulkSds(client *c, sds s) {
- addReplySds(c,sdscatfmt(sdsempty(),"$%u\r\n",
- (unsigned long)sdslen(s)));
+ addReplyLongLongWithPrefix(c,sdslen(s),'$');
addReplySds(c,s);
addReply(c,shared.crlf);
}