Message86841
This is my test on another faster machine.
$ cat test.py
import sys, time, uuid
N = int(sys.argv[1])
t = time.time()
for x in xrange(N):
uuid.uuid1()
print('%.3f microseconds' % ((time.time() - t) * 1000000.0 / N))
$ cat test.c
#include <stdio.h>
#include <sys/time.h>
#include <uuid/uuid.h>
int main(int argc, char *argv[])
{
int i, n;
double t1, t2;
uuid_t uuid;
struct timeval t;
struct timezone tz;
sscanf(argv[1], "%d", &n);
gettimeofday(&t, &tz);
t1 = (double)t.tv_sec + (double)t.tv_usec / 1000000.0;
for (i = 0; i < n; i++) {
uuid_generate_time(uuid);
}
gettimeofday(&t, &tz);
t2 = (double)t.tv_sec + (double)t.tv_usec / 1000000.0;
printf("%.3f microseconds\n", (t2 - t1) * 1000000.0 / n);
return 0;
}
$ gcc -l uuid -o test test.c
$ python test.py 50000
25.944 microseconds
$ python test.py 200000
25.810 microseconds
$ python test.py 1000000
25.865 microseconds
$ ./test 50000
0.214 microseconds
$ ./test 200000
0.214 microseconds
$ ./test 1000000
0.212 microseconds
$ |
|
Date |
User |
Action |
Args |
2009-04-30 10:42:55 | wangchun | set | recipients:
+ wangchun |
2009-04-30 10:42:55 | wangchun | set | messageid: <1241088175.55.0.333441115985.issue5885@psf.upfronthosting.co.za> |
2009-04-30 10:42:54 | wangchun | link | issue5885 messages |
2009-04-30 10:42:53 | wangchun | create | |
|