[New-bugs-announce] [issue5885] uuid.uuid1() is too slow

Wang Chun report at bugs.python.org
Thu Apr 30 12:13:36 CEST 2009

New submission from Wang Chun <yaohua2000 at gmail.com>:

uuid.uuid1() currently uses two different ways to generate a uuid. If 
the system call "uuid_generate_time" is available, uuid1() uses the 
system call via the ctypes interface, otherwise, it uses pure Python 
code to generate a uuid. The problem is, the C interface 
"uuid_generate_time" is even slower than the Python code. The ctypes 
interface is too slow. According to my test, it took 55 microseconds to 
generate a uuid via ctypes interface but only 45 microseconds via the 
Python code. I also tried to test the performance of the 
"uuid_generate_time" C API itself. It takes C code 12 microseconds. Most 
of the time were wasted on ctypes. I believe we need to drop ctypes and 
write a Python extensions in C for this job.

components: Library (Lib)
messages: 86840
nosy: wangchun
severity: normal
status: open
title: uuid.uuid1() is too slow
type: performance
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list