Closed
Description
Feature or enhancement
Proposal:
In my tests, using bytes.hex() speeds up calling the UUID.hex property.
Additionally, using the hex property and f-strings also provides some speedup in calling uuid.UUID.str.
import uuid
uuids = [uuid.uuid4() for _ in range(100000)]
t1 = time.monotonic()
for u in uuids:
u.hex
# str(u)
t2 = time.monotonic()
print(t2 - t1)
Results before and after the fix:
hex
before: 0.021755493999989994
after: 0.01465080400066654
str
before: 0.06381790500017814
after: 0.05134949700004654
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response