Title: gh-130167: Minor `textwrap.dedent()` optimization by Marius-Juston · Pull Request #131925 · python/cpython · GitHub
Open Graph Title: gh-130167: Minor `textwrap.dedent()` optimization by Marius-Juston · Pull Request #131925 · python/cpython
X Title: gh-130167: Minor `textwrap.dedent()` optimization by Marius-Juston · Pull Request #131925 · python/cpython
Description: Minor optimization to @AA-Turner #131792 where you compute the min and max of the non_blank_lines simultaneously, removes additional use of line.isspace() as well. Benchmark raw new raw_text: "abc \t" 2.91 ms 3.33 ms: 1.15x slower raw_text: " " 4.31 ms 4.17 ms: 1.03x faster raw_text: " \t abc" 4.04 ms 4.40 ms: 1.09x slower raw_text: " \t abc \t " 4.08 ms 4.40 ms: 1.08x slower raw_text: 1000 spaces 34.9 ms 27.9 ms: 1.25x faster Basic indented text with empty lines 1.88 us 1.82 us: 1.03x faster Text with mixed indentation and blank lines 1.85 us 1.79 us: 1.03x faster No indentation (edge case) 1.24 us 1.14 us: 1.09x faster Only blank lines 958 ns 641 ns: 1.49x faster Edge case: No common prefix to remove 1.09 us 993 ns: 1.10x faster Edge case: Single indented line 998 ns 855 ns: 1.17x faster Edge case: Single indented line only 631 ns 432 ns: 1.46x faster Edge case: Empty text 89.3 ns 81.0 ns: 1.10x faster no_indent 2.57 us 2.50 us: 1.03x faster mixed 10.4 us 10.9 us: 1.05x slower large_text 77.7 us 85.7 us: 1.10x slower whitespace_only 859 ns 599 ns: 1.43x faster Geometric mean (ref) 1.08x faster Issue: gh-130167
Open Graph Description: Minor optimization to @AA-Turner #131792 where you compute the min and max of the non_blank_lines simultaneously, removes additional use of line.isspace() as well. Benchmark raw new raw_tex...
X Description: Minor optimization to @AA-Turner #131792 where you compute the min and max of the non_blank_lines simultaneously, removes additional use of line.isspace() as well. Benchmark raw new raw_tex...
Opengraph URL: https://github.com/python/cpython/pull/131925
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3f446827-f18e-aa55-5e5c-e574734fb447 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B752:A39F5:1F571C1:2AA3E3E:696AC53C |
| html-safe-nonce | 061cf970f793dee79c24e0eb198d24f9f92dcda1b6c8d1104d640e82c1eee3ad |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzUyOkEzOUY1OjFGNTcxQzE6MkFBM0UzRTo2OTZBQzUzQyIsInZpc2l0b3JfaWQiOiI3MDY3MzE1OTc1MjAyOTgxMTgwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | cde73577e23742cf8641dbfb1e1a1a0cab3285c8c0a61349ccd74282148904b2 |
| hovercard-subject-tag | pull_request:2427894371 |
| 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/131925/files |
| twitter:image | https://avatars.githubusercontent.com/u/19751068?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/19751068?s=400&v=4 |
| og:image:alt | Minor optimization to @AA-Turner #131792 where you compute the min and max of the non_blank_lines simultaneously, removes additional use of line.isspace() as well. Benchmark raw new raw_tex... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 986b6a1d774985095564e64d6963d11f094da3d0e2bfda2ab1a27d63662eb033 |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 89ad2112b9c4e11df6a0c13c8c1f8eedd36b0977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width