summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-09-25 15:33:46 +0200
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-09-25 15:33:46 +0200
commit8345467b2e391aa0e62414d48abcc15c6291d945 (patch)
tree2da529c05d55be00f7b1b2fe23c07501ddaa17a1 /test.c
parent9e417047edb4e95dcffbd8827f0f6a4f1fcdab51 (diff)
Free the replies after the tests are done
Diffstat (limited to 'test.c')
-rw-r--r--test.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/test.c b/test.c
index 58772fc..ab73e70 100644
--- a/test.c
+++ b/test.c
@@ -149,16 +149,20 @@ int main(void) {
for (i = 0; i < 500; i++)
freeReplyObject(redisCommand(c,"LPUSH mylist foo"));
+ replies = malloc(sizeof(redisReply*)*1000);
t1 = usec();
- for (i = 0; i < 1000; i++)
- freeReplyObject(redisCommand(c,"PING"));
+ for (i = 0; i < 1000; i++) replies[i] = redisCommand(c,"PING");
t2 = usec();
+ for (i = 0; i < 1000; i++) freeReplyObject(replies[i]);
+ free(replies);
printf("\t(1000x PING: %.2fs)\n", (t2-t1)/1000000.0);
+ replies = malloc(sizeof(redisReply*)*1000);
t1 = usec();
- for (i = 0; i < 1000; i++)
- freeReplyObject(redisCommand(c,"LRANGE mylist 0 499"));
+ for (i = 0; i < 1000; i++) replies[i] = redisCommand(c,"LRANGE mylist 0 499");
t2 = usec();
+ for (i = 0; i < 1000; i++) freeReplyObject(replies[i]);
+ free(replies);
printf("\t(1000x LRANGE with 500 elements: %.2fs)\n", (t2-t1)/1000000.0);
/* Clean DB 9 */