Sha256: 9cacf866bcbae796280b96f22b307cc4561548c49bceb8a856556a5ccf84f04b

Contents?: true

Size: 613 Bytes

Versions: 322

Compression:

Stored size: 613 Bytes

Contents

/*
Test performance of native C UUID generation

To Compile: cc -luuid benchmark-native.c -o benchmark-native
*/

#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <uuid/uuid.h>

int main() {
  uuid_t myid;
  char buf[36+1];
  int i;
  struct timeval t;
  double start, finish;

  gettimeofday(&t, NULL);
  start = t.tv_sec + t.tv_usec/1e6;

  int n = 2e5;
  for (i = 0; i < n; i++) {
    uuid_generate(myid);
    uuid_unparse(myid, buf);
  }

  gettimeofday(&t, NULL);
  finish = t.tv_sec + t.tv_usec/1e6;
  double dur = finish - start;

  printf("%d uuids/sec", (int)(n/dur));
  return 0;
}

Version data entries

322 entries across 163 versions & 16 rubygems

Version Path
vulcan-0.0.3 server/node_modules/node-uuid/test/benchmark-native.c
vulcan-0.0.2 server/node_modules/node-uuid/test/benchmark-native.c