Title: GH-98363: Presize the list for batched() by rhettinger · Pull Request #98419 · python/cpython · GitHub
Open Graph Title: GH-98363: Presize the list for batched() by rhettinger · Pull Request #98419 · python/cpython
X Title: GH-98363: Presize the list for batched() by rhettinger · Pull Request #98419 · python/cpython
Description: Presizing the result lists saves space from list over-allocation and is faster than the PyList_Append() approach. This is a short PR but it took a while to figure out that PyList_GetSlice() would make short work of the problem. Ideally, we need something like _PyTuple_Resize() to resize the list inplace using a realloc() and updating the allocated field. Issue: gh-98363
Open Graph Description: Presizing the result lists saves space from list over-allocation and is faster than the PyList_Append() approach. This is a short PR but it took a while to figure out that PyList_GetSlice() would m...
X Description: Presizing the result lists saves space from list over-allocation and is faster than the PyList_Append() approach. This is a short PR but it took a while to figure out that PyList_GetSlice() would m...
Opengraph URL: https://github.com/python/cpython/pull/98419
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f43285ef-07de-3fb7-bad2-bdd8b8ee728a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D190:3FFE1:230D02:2E9010:6969CBCD |
| html-safe-nonce | bd6880e44e87bd63ff629fb0fdc1562f6a827a59948232f3b202280daf6ca609 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTkwOjNGRkUxOjIzMEQwMjoyRTkwMTA6Njk2OUNCQ0QiLCJ2aXNpdG9yX2lkIjoiODQ2NDc1MjM3NjE4NDY5ODM3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | bd15c9fc3aa39b537ccd932c41c84409e42351d86e76da9970d57d7733c9584b |
| hovercard-subject-tag | pull_request:1091437032 |
| 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/98419/files |
| twitter:image | https://avatars.githubusercontent.com/u/1623689?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1623689?s=400&v=4 |
| og:image:alt | Presizing the result lists saves space from list over-allocation and is faster than the PyList_Append() approach. This is a short PR but it took a while to figure out that PyList_GetSlice() would m... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| 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 | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width