Uh oh!
There was an error while loading. Please reload this page.
gh-91349: Adjust default compression level to 6 (down from 9) in gzip and tarfile - #131470
Conversation
e2d0562 to
a2d0966Compare…n gzip and tarfile It is the default level used by most compression tools and a better tradeoff between speed and performance.
a2d0966 to
b17e21dCompareUh oh!
There was an error while loading. Please reload this page.
morotti
commented
Jun 25, 2025
@merwok I added the versionchanged notes. and found another comment in tarfile.rst to adjust. You can review again. |
morotti
commented
Jun 27, 2025
@gpshead you've replied multiple times to my questions on improving compression code with "PR welcome". maybe you would be interested in reviewing this PR? |
morotti
commented
Jul 18, 2025
can anybody review the PR please? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
morotti
commented
Jul 18, 2025
are you two saying that this fix will not be able to ship with python 3.14? |
set versionchanged to next Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
set versionchanged to next
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
set versionchanged to next
morotti
commented
Jul 18, 2025
done, adjusted all the |
gpshead
commented
Jul 19, 2025
wow, checking the source history it looks like "9" was used when the gzip module was added circa 1997. ironic, i'd have never expected that as a default. "6" being the bare "gzip" default value is just a well known thing. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…TOCP.rst highlight function in rst file
morotti
commented
Jul 20, 2025
@ethanfurman the PR says it's "pending review" from you, can you approve? @gpshead I adjusted the rst to highlight the function, as per the code suggestion. Indeed, the very first commit from April 1997 set the compression level to 9. It's been wrong for 28 years. :D I first came across this bug about 9 years ago, when using tornado (web framework). It took whole seconds to compress HTTP responses with the gzip=9 default and slow down every request (whole seconds of delay to compress a couple MB). Tornado was patched to set compresslevel=6 but I never came around to fix the interpreter until now. This PR is the fix of a lifetime :D |
Uh oh!
There was an error while loading. Please reload this page.
merwok
commented
Jul 23, 2025
It seems that I misinterpreted the status of 3.14: rc phase started today, we were in beta before. Would this change (accepted 2 days ago) have been ok for 3.14 @hugovk ? |
gpshead
commented
Jul 23, 2025
Entirely up to Hugo. I personally wouldn't bother trying to put this in 3.14 in the rc phase. The perhaps unusual default has been that way for decades now so there is no urgency in changing it. People who want speed are already passing their own compresslevel, or when possible, using a far more modern algorithm than venerable zlib based gzip. |
…n gzip and tarfile (pythonGH-131470) pythongh-91349: Adjust default compression level to 6 (down from 9) in gzip and tarfile It is the default level used by most compression tools and a better tradeoff between speed and performance. Co-authored-by: rmorotti <romain.morotti@man.com> Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
hugovk
commented
Aug 7, 2025
Yeah, let's keep it for 3.15. |
…n gzip and tarfile (pythonGH-131470) pythongh-91349: Adjust default compression level to 6 (down from 9) in gzip and tarfile It is the default level used by most compression tools and a better tradeoff between speed and performance. Co-authored-by: rmorotti <romain.morotti@man.com> Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
It is the default level used by most compression tools and a better tradeoff between speed and performance.
see discussion in #91349 (comment)
📚 Documentation preview 📚: https://cpython-previews--131470.org.readthedocs.build/