[issue22131] uuid.bytes optimization

Serhiy Storchaka report at bugs.python.org
Mon Aug 4 10:09:00 CEST 2014


Serhiy Storchaka added the comment:

If such changes are acceptable, here is a part of my large patch fo modernizing stdlib sources.

Some microbenchmarks:

$ ./python -m timeit -s "from uuid import NAMESPACE_DNS as u" -- "u.bytes"
$ ./python -m timeit -s "from uuid import NAMESPACE_DNS as u" -- "u.bytes_le"
$ ./python -m timeit -s "from uuid import UUID" -- "UUID(bytes_le=b'abcdefghijklmnop')"

Before patch:
10000 loops, best of 3: 66.9 usec per loop
10000 loops, best of 3: 102 usec per loop
10000 loops, best of 3: 65.2 usec per loop

After patch:
100000 loops, best of 3: 3.98 usec per loop
100000 loops, best of 3: 10.8 usec per loop
10000 loops, best of 3: 32.1 usec per loop

----------
nosy: +serhiy.storchaka
Added file: http://bugs.python.org/file36245/modernize_uuid.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22131>
_______________________________________


More information about the Python-bugs-list mailing list