Title: gh-89550: Buffer GzipFile.write to reduce execution time by ~15% by CCLDArjun · Pull Request #101251 · python/cpython · GitHub
Open Graph Title: gh-89550: Buffer GzipFile.write to reduce execution time by ~15% by CCLDArjun · Pull Request #101251 · python/cpython
X Title: gh-89550: Buffer GzipFile.write to reduce execution time by ~15% by CCLDArjun · Pull Request #101251 · python/cpython
Description: Currently, all of this is done for every write() call: https://github.com/python/cpython/blob/main/Lib/gzip.py#L266-L288 This pr stores GzipFile.write() data into a buffer to postpone most of the compression work to when the buffer flushes. This way, we can call into zlib and File.write() less frequently. benchmarking with timeit: ../python -m timeit -s 'import gzip ' 'with gzip.open("./Python-3.11.1.tgz", "rb") as infile: ' ' with gzip.open("./Python-3.11.1new.tgz", "wb") as outfile: ' ' for line in infile: ' ' outfile.write(line) ' ' ' 1 loop, best of 5: 6.36 sec per loop vs ../python -m timeit -s 'import gzipold as gzip ' 'with gzip.open("./Python-3.11.1.tgz", "rb") as infile: ' ' with gzip.open("./Python-3.11.1new.tgz", "wb") as outfile: ' ' for line in infile: ' ' outfile.write(line) ' ' ' 1 loop, best of 5: 7.68 sec per loop Issue: gh-89550
Open Graph Description: Currently, all of this is done for every write() call: https://github.com/python/cpython/blob/main/Lib/gzip.py#L266-L288 This pr stores GzipFile.write() data into a buffer to postpone most of the c...
X Description: Currently, all of this is done for every write() call: https://github.com/python/cpython/blob/main/Lib/gzip.py#L266-L288 This pr stores GzipFile.write() data into a buffer to postpone most of the c...
Opengraph URL: https://github.com/python/cpython/pull/101251
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:aa2e3f8e-ca4e-587b-9b54-bc1ba5d69d9d |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | CE10:7F615:13A4201:1A6F8A8:6969B3EE |
| html-safe-nonce | 09b197a6ba98a6524b7cf358f347a710324385954a826ad2e865828e29bd2457 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTEwOjdGNjE1OjEzQTQyMDE6MUE2RjhBODo2OTY5QjNFRSIsInZpc2l0b3JfaWQiOiI2NjU5OTc2MTYxNTQ0MjIxNjc4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1df504d5c269455814f71f0f153947e60a8d1553bf0b2877ab8799338196481c |
| hovercard-subject-tag | pull_request:1212758599 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/101251/checks |
| twitter:image | https://avatars.githubusercontent.com/u/31632587?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/31632587?s=400&v=4 |
| og:image:alt | Currently, all of this is done for every write() call: https://github.com/python/cpython/blob/main/Lib/gzip.py#L266-L288 This pr stores GzipFile.write() data into a buffer to postpone most of the c... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b23b8fcc855cd29bb04d6c94aafa62d336bf44eefa8229444eecc968cad03aee |
| turbo-cache-control | no-preview |
| 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 full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0672399d88424758731ec07fe24509e23bb17fb5 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width