Skip to content

Commit 4e5f175

Browse files
rhpvordermanadorilson
authored andcommitted
bpo-43317: Use io.DEFAULT_BUFFER_SIZE instead of 1024 in gzip CLI (python#24645)
This improves the performance slightly.
1 parent e089525 commit 4e5f175

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Lib/gzip.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def main():
595595
f = builtins.open(arg, "rb")
596596
g = open(arg + ".gz", "wb")
597597
while True:
598-
chunk = f.read(1024)
598+
chunk = f.read(io.DEFAULT_BUFFER_SIZE)
599599
if not chunk:
600600
break
601601
g.write(chunk)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Set the chunk size for the ``gzip`` module main function to
2+
io.DEFAULT_BUFFER_SIZE. This is slightly faster than the 1024 bytes constant
3+
that was used previously.

0 commit comments

Comments
 (0)