85 >>> def test():
for _ in xrange(1000000):
uuid.uuid1()
...:
88 >>> %timeit test()
1 loops, best of 3: 40.3 s per loop
=> 24 813 per second
See also:
Python (using python-libuuid extension)
3 >>> def test():
for _ in xrange(1000000):
..: libuuid.uuid1()
..:
4 >>> %timeit test()
1 loops, best of 3: 12.4 s per loop
=> 80 645 per second
5 >>> def test():
for _ in xrange(1000000):
..: libuuid.uuid1_bytes()
..:
6 >>> %timeit test()
1 loops, best of 3: 8.07 s per loop
=> 123 915 per second
See also:
user >>> (import [com.eaio.uuid])
nil
user >>> (time (dorun (repeatedly 1000000 #(com.eaio.uuid.UUID.))))
"Elapsed time: 561.999 msecs"
nil
=> 1 779 362 per second
user >>> (import [org.safehaus.uuid])
nil
user >>> (let [gen (org.safehaus.uuid.UUIDGenerator/getInstance)]
(time (dorun (repeatedly 1000000 #(.generateTimeBasedUUID gen)))))
"Elapsed time: 641.732 msecs"
=> 1 558 283 per second
See also:
$ cat << EOF | gcc -O2 -xc -luuid - && time ./a.out
> #include <uuid/uuid.h>
>
> int main(int argc, char **argv)
> {
> int i;
> uuid_t uuid;
> for (i=0; i<1000000; i++) {
> uuid_generate_time(uuid);
> }
> }
> EOF
real 0m7.093s
user 0m0.792s
sys 0m6.161s
=> 140 984 per second
This seems really slow. Anyone know why?
See also:
See also: http://github.com/dln/python-libuuid