Title: gh-118761: Reduce import time of gettext.py by delaying re import by eli-schwartz · Pull Request #128898 · python/cpython · GitHub
Open Graph Title: gh-118761: Reduce import time of gettext.py by delaying re import by eli-schwartz · Pull Request #128898 · python/cpython
X Title: gh-118761: Reduce import time of gettext.py by delaying re import by eli-schwartz · Pull Request #128898 · python/cpython
Description: gettext is often imported in programs that may not end up translating anything. In fact, the struct module already has a delayed import when parsing GNUTranslations to speed up the no .mo files case. The re module is also used in the same situation, but behind a function chain only called by GNUTranslations. cache the compiled regex globally the first time it is used. The finditer function can be converted to a method call on the compiled object (it always could) which is slightly more efficient and necessary for the conditional re import. Issue: gh-118761
Open Graph Description: gettext is often imported in programs that may not end up translating anything. In fact, the struct module already has a delayed import when parsing GNUTranslations to speed up the no .mo files cas...
X Description: gettext is often imported in programs that may not end up translating anything. In fact, the struct module already has a delayed import when parsing GNUTranslations to speed up the no .mo files cas...
Opengraph URL: https://github.com/python/cpython/pull/128898
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a4546912-8471-e489-5f6c-3a9c078f4198 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C860:1D189C:A95907:E2064B:6969941F |
| html-safe-nonce | 314e0be347f77df4bf5b808bc506f1f8a3d6542935c39925d37e3df82d309a57 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODYwOjFEMTg5QzpBOTU5MDc6RTIwNjRCOjY5Njk5NDFGIiwidmlzaXRvcl9pZCI6IjM4OTc0MDYxMzY4MDAzNTEyNjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 281ca91b522e3b6457cfdbd8e30a5e696000b123527f7368257f92603def6bc2 |
| hovercard-subject-tag | pull_request:2280585531 |
| 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/128898/files |
| twitter:image | https://avatars.githubusercontent.com/u/6551424?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/6551424?s=400&v=4 |
| og:image:alt | gettext is often imported in programs that may not end up translating anything. In fact, the struct module already has a delayed import when parsing GNUTranslations to speed up the no .mo files cas... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3542e147982176a7ebaa23dfb559c8af16f721c03ec560c68c56b64a0f35e751 |
| 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 | af80af7cc9e3de9c336f18b208a600950a3c187c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width