[New-bugs-announce] [issue22131] uuid.bytes optimization

Kevin London report at bugs.python.org
Mon Aug 4 04:05:56 CEST 2014

New submission from Kevin London:

Generating the byte representation of a UUID object can be a little faster by using binascii's unhexlify on the hex value of the UUID object. In my testing, I saw about a 5.5x speed increase with the attached changes. 

Here are a set of benchmarks that I ran, which are inspired by Wang Chun's benchmarks on http://bugs.python.org/issue5885:


My times:

kevin$ python uuid_benchmark.py 100000
Original Average: 8.049 microseconds
Updated Average: 1.447 microseconds
I re-ran all of the tests with the patched uuid module and they passed. Here's my patchcheck output as well:

kevin$ make patchcheck
./python.exe ./Tools/scripts/patchcheck.py
Getting the list of files that have been added/changed ... 1 file
Fixing whitespace ... 0 files
Fixing C file whitespace ... 0 files
Fixing docs whitespace ... 0 files
Docs modified ... NO
Misc/ACKS updated ... NO
Misc/NEWS updated ... NO
configure regenerated ... not needed
pyconfig.h.in regenerated ... not needed


assignee: ronaldoussoren
components: Benchmarks, Library (Lib), Macintosh
files: uuid_bytes_update.patch
keywords: patch
messages: 224671
nosy: kevinlondon, ronaldoussoren
priority: normal
severity: normal
status: open
title: uuid.bytes optimization
type: performance
versions: Python 2.7
Added file: http://bugs.python.org/file36241/uuid_bytes_update.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list