Title: gh-118761: Improve import time of `cmd` module by donbarbos · Pull Request #130056 · python/cpython · GitHub
Open Graph Title: gh-118761: Improve import time of `cmd` module by donbarbos · Pull Request #130056 · python/cpython
X Title: gh-118761: Improve import time of `cmd` module by donbarbos · Pull Request #130056 · python/cpython
Description: I use lazy import for inspect module (called 1 time). And I suggest getting rid of import string. This will improve import time as much as possible (benchmarks without string module separately in second comment). CPython configure flags: ./configure --enable-optimizations --with-lto --enable-loadable-sqlite-extensions Benchmarks: Running: pipx install tuna && ./python -X importtime -c 'import cmd' 2> import.log && tuna import.log Total import time: 0.023s -> 0.013s = x1.77 as fast main branch PR branch cmd import time: 0.016s -> 0.007s = x2.29 as fast main branch PR branch hyperfine: 23.7ms -> 15.0ms = x1.58 as fast Main branch: $ hyperfine --warmup 11 "./python -c 'import cmd'" Benchmark 1: ./python -c 'import cmd' Time (mean ± σ): 23.7 ms ± 0.3 ms [User: 20.3 ms, System: 3.3 ms] Range (min … max): 23.1 ms … 25.7 ms 123 runs PR branch: $ hyperfine --warmup 11 "./python -c 'import cmd'" Benchmark 1: ./python -c 'import cmd' Time (mean ± σ): 15.0 ms ± 0.3 ms [User: 12.6 ms, System: 2.4 ms] Range (min … max): 14.4 ms … 16.0 ms 189 runs Issue: gh-118761
Open Graph Description: I use lazy import for inspect module (called 1 time). And I suggest getting rid of import string. This will improve import time as much as possible (benchmarks without string module separately in s...
X Description: I use lazy import for inspect module (called 1 time). And I suggest getting rid of import string. This will improve import time as much as possible (benchmarks without string module separately in s...
Opengraph URL: https://github.com/python/cpython/pull/130056
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:91508664-52e5-6c8a-30e5-d43004dc5630 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 836E:269EF9:4B8968:67C702:6969DE7A |
| html-safe-nonce | 4f3e603185b52c1d5064ce29eb3ddfe5ce2f04379f873bb78de1b94961664fbc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzZFOjI2OUVGOTo0Qjg5Njg6NjdDNzAyOjY5NjlERTdBIiwidmlzaXRvcl9pZCI6IjIyODY1NzcyMTc5MTY0OTM0MzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2720a2713d9fc4bd4f55fea2617afe352e0b6c6daeb28706c2ce516aac066e3b |
| hovercard-subject-tag | pull_request:2332412865 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/130056/files |
| twitter:image | https://avatars.githubusercontent.com/u/47272787?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/47272787?s=400&v=4 |
| og:image:alt | I use lazy import for inspect module (called 1 time). And I suggest getting rid of import string. This will improve import time as much as possible (benchmarks without string module separately in s... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width