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: https://gist.github.com/kevinlondon/d3bb32d5a784f78731fa 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 Thanks! ---------- 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 <rep...@bugs.python.org> <http://bugs.python.org/issue22131> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com