-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Improve perfomance of UUID.hex and UUID.__str__ by using bytes.hex() #131196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In other words, it boils down between whether Now, I would appreciate benchmarks using |
Thanks for the answer! This is how the interpreter was built:
Here are the measurement results:
|
Mmh. The improvement is a small, but it's still a improvement I guesss. It's still > 10% improvement! |
#131197) Results before and after the fix: ``` hex before: 0.021755493999989994 after: 0.01465080400066654 str before: 0.06381790500017814 after: 0.05134949700004654 ``` Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Thank you for the PR! Please, feel free to suggest more optimizations. |
…by ~10% (python#131197) Results before and after the fix: ``` hex before: 0.021755493999989994 after: 0.01465080400066654 str before: 0.06381790500017814 after: 0.05134949700004654 ``` Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…by ~10% (python#131197) Results before and after the fix: ``` hex before: 0.021755493999989994 after: 0.01465080400066654 str before: 0.06381790500017814 after: 0.05134949700004654 ``` Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
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.
Results before and after the fix:
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: