From ea31a4eae3c667ffb8c33241c5de699652710394 Mon Sep 17 00:00:00 2001 From: spinlock Date: Wed, 5 Jul 2017 14:25:05 +0000 Subject: [PATCH 1/2] Optimize addReplyBulkSds for better performance --- src/networking.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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); } From 10db81af71a6d4c4f99a59510939a2b4dc8f6864 Mon Sep 17 00:00:00 2001 From: spinlock Date: Wed, 5 Jul 2017 14:32:07 +0000 Subject: [PATCH 2/2] update Makefile for test-sds --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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