Skip to content

Instantly share code, notes, and snippets.

@michael-grunder
Created August 1, 2014 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michael-grunder/c92ef31bb632b3d0ad81 to your computer and use it in GitHub Desktop.
Save michael-grunder/c92ef31bb632b3d0ad81 to your computer and use it in GitHub Desktop.
include "hiredis.h"
#include <time.h>
/* Contrived arguments */
const char* argv[] = { "ZUNIONSTORE", "out-set", "5", "one", "two", "three", "four", "five"};
const size_t argvlen[] = {11, 6, 1, 3, 3, 5, 4, 4};
const int argc = 8;
/* Runs to perform */
const int N = 1000000;
int main(void) {
double t1, t2;
int i;
redisContext *c = redisConnect("127.0.0.1", 6379);
t1 = clock();
for(i=0;i<N;i++) {
redisAppendCommandArgv(c, argc, (const char **)argv,
(const size_t *)argvlen);
}
t2 = clock();
printf("Timing: %f\n", ((double)t2-t1)/CLOCKS_PER_SEC);
redisFree(c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment