Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-109653: Reduce import overhead of uuid module on Linux#115160

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hauntsaninja merged 2 commits intopython:mainfromhauntsaninja:uuid-import
Mar 6, 2024

Conversation

hauntsaninja
Copy link
Contributor

@hauntsaninjahauntsaninja commentedFeb 8, 2024
edited by bedevere-appbot
Loading

This follows in the footsteps of#21586
This speeds up import uuid by about 6ms on Linux.

Before:

λ hyperfine -w 4 "./python -c 'import uuid'"Benchmark 1: ./python -c 'import uuid'  Time (mean ± σ):      20.4 ms ±   0.4 ms    [User: 16.7 ms, System: 3.8 ms]  Range (min … max):    19.6 ms …  21.8 ms    136 runs

After:

λ hyperfine -w 4 "./python -c 'import uuid'"Benchmark 1: ./python -c 'import uuid'  Time (mean ± σ):      14.5 ms ±   0.3 ms    [User: 11.5 ms, System: 3.2 ms]  Range (min … max):    13.9 ms …  16.0 ms    175 runs

This follows in the footsteps ofpython#21586This speeds up import uuid by about 6ms on Linux.Before:```λ hyperfine -w 4 "./python -c 'import uuid'"Benchmark 1: ./python -c 'import uuid'  Time (mean ± σ):      20.4 ms ±   0.4 ms    [User: 16.7 ms, System: 3.8 ms]  Range (min … max):    19.6 ms …  21.8 ms    136 runs```After:```λ hyperfine -w 4 "./python -c 'import uuid'"Benchmark 1: ./python -c 'import uuid'  Time (mean ± σ):      14.5 ms ±   0.3 ms    [User: 11.5 ms, System: 3.2 ms]  Range (min … max):    13.9 ms …  16.0 ms    175 runs```
@hauntsaninjahauntsaninja changed the titlegh-109653: Reduce import overhead of uuid modulegh-109653: Reduce import overhead of uuid module on LinuxFeb 8, 2024
@zoobazooba removed their request for reviewFebruary 8, 2024 14:14
@zooba
Copy link
Member

I'm not the right person to review this.

You need someone who knows whethersys.platform == "linux" implies the same things as the platform module. In general, they don't, so if you want my review I would reject this change as being too risky.

hauntsaninja reacted with thumbs up emoji

@hauntsaninja
Copy link
ContributorAuthor

hauntsaninja commentedFeb 8, 2024
edited
Loading

Thanks for the quick response! I'll wait for someone else to review.

The value ofsys.platform comes from

case$MACHDEPin
while the value ofplatform.system comes fromos.uname + munging and falling back tosys.platform

Note we don't need a one-to-one correspondence here (and I'm not sure there is one, e.g. on ancient Python versions it was possible to havesys.platform == "linux2" while presumablyplatform.system() was still Linux). But we just need implication in one direction since we preserve theelse branch.

@ofek
Copy link
Contributor

This seems correct to me; I don't see any risk to this change.

@hauntsaninjahauntsaninja merged commit68b8fff intopython:mainMar 6, 2024
@hauntsaninjahauntsaninja deleted the uuid-import branchMarch 6, 2024 22:39
adorilson pushed a commit to adorilson/cpython that referenced this pull requestMar 25, 2024
…on#115160)This follows in the footsteps ofpython#21586This speeds up import uuid by about 6ms on Linux.Before:```λ hyperfine -w 4 "./python -c 'import uuid'"Benchmark 1: ./python -c 'import uuid'  Time (mean ± σ):      20.4 ms ±   0.4 ms    [User: 16.7 ms, System: 3.8 ms]  Range (min … max):    19.6 ms …  21.8 ms    136 runs```After:```λ hyperfine -w 4 "./python -c 'import uuid'"Benchmark 1: ./python -c 'import uuid'  Time (mean ± σ):      14.5 ms ±   0.3 ms    [User: 11.5 ms, System: 3.2 ms]  Range (min … max):    13.9 ms …  16.0 ms    175 runs```
diegorusso pushed a commit to diegorusso/cpython that referenced this pull requestApr 17, 2024
…on#115160)This follows in the footsteps ofpython#21586This speeds up import uuid by about 6ms on Linux.Before:```λ hyperfine -w 4 "./python -c 'import uuid'"Benchmark 1: ./python -c 'import uuid'  Time (mean ± σ):      20.4 ms ±   0.4 ms    [User: 16.7 ms, System: 3.8 ms]  Range (min … max):    19.6 ms …  21.8 ms    136 runs```After:```λ hyperfine -w 4 "./python -c 'import uuid'"Benchmark 1: ./python -c 'import uuid'  Time (mean ± σ):      14.5 ms ±   0.3 ms    [User: 11.5 ms, System: 3.2 ms]  Range (min … max):    13.9 ms …  16.0 ms    175 runs```
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@hauntsaninja@zooba@ofek

[8]ページ先頭

©2009-2025 Movatter.jp