Skip to content

Conversation

@picnixz
Copy link
Member

@picnixzpicnixz commented Jun 28, 2025

Copy link
Member

@sobolevnsobolevn left a comment

Choose a reason for hiding this comment

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

Can you please provide a benchmark for realistical platforms and some unrealistically big ones?

@picnixz
Copy link
MemberAuthor

picnixz commented Jun 28, 2025

Can you please provide a benchmark for realistical platforms and some unrealistically big ones?

For realistic ones, there should be no difference (because the strings are REALLY small). For unrealistically big ones, I'll write them.

@picnixzpicnixz changed the title gh-136066: reduce asymptotic complexity of platform._platform()gh-136066: simplify platform._platform()Jun 28, 2025
@picnixzpicnixz added the type-refactor Code refactoring (with no changes in behavior) label Jun 28, 2025
@picnixz
Copy link
MemberAuthor

For the benchmarks:

./python -m pyperf timeit -s 'import platform; s="-" *1_000_000''platform._platform(s)'

On a PGO+LTO build:

Mean +- std dev: [ref] 5.83 ms +- 0.12 ms -> [new] 881 us +- 11 us: 6.62x faster 

Copy link
Member

@sobolevnsobolevn left a comment

Choose a reason for hiding this comment

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

Awesome results! Thank you!

@picnixzpicnixz merged commit bd928a3 into python:mainJun 29, 2025
45 checks passed
@picnixzpicnixz deleted the refactor/platform/strip-136066 branch June 29, 2025 07:56
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request Jul 11, 2025
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstype-refactorCode refactoring (with no changes in behavior)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@picnixz@serhiy-storchaka@sobolevn