This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rosslagerwall
Recipients alexandre.vassalotti, grooverdan, rosslagerwall, thijs, wangchun
Date 2011-01-22.08:56:17
SpamBayes Score 1.2321208e-05
Marked as misclassified No
Message-id <1295686580.27.0.93011099263.issue5885@psf.upfronthosting.co.za>
In-reply-to
Content
Attached is a patch based on the original patch, meant to have better performance.

On my PC, this:

import sys, time, uuid

def uu(n):
    t = time.time()
    for x in range(n):
        uuid.uuid1()
    print('%.3f microseconds' % ((time.time() - t) * 1000000.0 / n))

uu(50000)

records a time of 38.5 microseconds unpatched (still using ctypes/libuuid) and a time of 16.5 microseconds afterwards.
uuid4() results in an improvement from 30 microseconds to 9 microseconds. From what I could see, what took the most time was the call to UUID() with a bytes object. That's why this patch passes in the uuid as a long.

It also fixes setup.py to check for the uuid.h header.
History
Date User Action Args
2011-01-22 08:56:20rosslagerwallsetrecipients: + rosslagerwall, alexandre.vassalotti, wangchun, thijs, grooverdan
2011-01-22 08:56:20rosslagerwallsetmessageid: <1295686580.27.0.93011099263.issue5885@psf.upfronthosting.co.za>
2011-01-22 08:56:18rosslagerwalllinkissue5885 messages
2011-01-22 08:56:18rosslagerwallcreate