- prepareForBenchmark("PING (multi bulk)");
- c = createClient();
- if (!c) exit(1);
- c->obuf = sdscat(c->obuf,"*1\r\n$4\r\nPING\r\n");
- prepareClientForReply(c,REPLY_RETCODE);
- createMissingClients(c);
- aeMain(config.el);
- endBenchmark();
-
- prepareForBenchmark("MSET (10 keys, multi bulk)");
- c = createClient();
- if (!c) exit(1);
- c->obuf = sdscatprintf(c->obuf,"*%d\r\n$4\r\nMSET\r\n", 11);
- {
- int i;
- char *data = zmalloc(config.datasize+2);
- memset(data,'x',config.datasize);
- for (i = 0; i < 10; i++) {
- c->obuf = sdscatprintf(c->obuf,"$%d\r\n%s\r\n",config.datasize,data);
- }
- zfree(data);
- }
- prepareClientForReply(c,REPLY_RETCODE);
- createMissingClients(c);
- aeMain(config.el);
- endBenchmark();
-
- prepareForBenchmark("SET");
- c = createClient();
- if (!c) exit(1);
- c->obuf = sdscat(c->obuf,"SET foo_rand000000000000 ");
- {
- char *data = zmalloc(config.datasize+2);
- memset(data,'x',config.datasize);
- data[config.datasize] = '\r';
- data[config.datasize+1] = '\n';
- c->obuf = sdscatlen(c->obuf,data,config.datasize+2);
+ data = zmalloc(config.datasize+1);
+ memset(data,'x',config.datasize);
+ data[config.datasize] = '\0';
+
+ benchmark("PING (inline)","PING\r\n",6);
+
+ len = redisFormatCommand(&cmd,"PING");
+ benchmark("PING",cmd,len);
+ free(cmd);
+
+ const char *argv[21];
+ argv[0] = "MSET";
+ for (i = 1; i < 21; i += 2) {
+ argv[i] = "foo:rand:000000000000";
+ argv[i+1] = data;