Skip to content

gh-131196: Improve perfomance of UUID.hex and UUID.__str__ by using bytes.hex()#131197

Merged
sobolevn merged 5 commits into
python:mainfrom
booqoffsky:fix-issue-131196
Mar 13, 2025
Merged

gh-131196: Improve perfomance of UUID.hex and UUID.__str__ by using bytes.hex()#131197
sobolevn merged 5 commits into
python:mainfrom
booqoffsky:fix-issue-131196

Conversation

@booqoffsky

@booqoffsky booqoffsky commented Mar 13, 2025

Copy link
Copy Markdown
Contributor

@ghost

ghost commented Mar 13, 2025

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app

bedevere-app Bot commented Mar 13, 2025

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@booqoffsky
booqoffsky marked this pull request as ready for review March 13, 2025 16:56
Comment thread Misc/NEWS.d/next/Library/2025-03-13-19-53-57.gh-issue-131196.3sBFv2.rst Outdated
Comment thread Lib/uuid.py Outdated
@picnixz picnixz self-assigned this Mar 13, 2025
booqoffsky and others added 2 commits March 13, 2025 22:29
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Comment thread Misc/NEWS.d/next/Library/2025-03-13-19-53-57.gh-issue-131196.3sBFv2.rst Outdated
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement! 10% speed up is good enough for such a short PR in my opinon.

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge this one tomorrow or @sobolevn can do it now if he's got time (I'm too tired to make a nice commit title and message :'))

@sobolevn
sobolevn merged commit 1121c80 into python:main Mar 13, 2025
plashchynski pushed a commit to plashchynski/cpython that referenced this pull request Mar 17, 2025
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants