- prepareForBenchmark("PING (multi bulk)");
- c = createClient(REDIS_REPLY_STATUS);
- c->obuf = sdscat(c->obuf,"*1\r\n$4\r\nPING\r\n");
- createMissingClients(c);
- aeMain(config.el);
- endBenchmark();
-
- prepareForBenchmark("MSET (10 keys, multi bulk)");
- c = createClient(REDIS_REPLY_ARRAY);
- 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);
- }
- createMissingClients(c);
- aeMain(config.el);
- endBenchmark();
-
- prepareForBenchmark("SET");
- c = createClient(REDIS_REPLY_STATUS);
- c->obuf = sdscat(c->obuf,"*3\r\n$3\r\nSET\r\n$20\r\nfoo_rand000000000000\r\n");
- {
- char *data = zmalloc(config.datasize+2);
- memset(data,'x',config.datasize);
- data[config.datasize] = '\r';
- data[config.datasize+1] = '\n';
- c->obuf = sdscatprintf(c->obuf,"$%d\r\n",config.datasize);
- 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;