Skip to content

Commit 62cea14

Browse files
committed
Set buffer size to 256MiB
1 parent bc1470d commit 62cea14

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/utils/ltfs_ordered_copy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,10 @@ class CopyQueue:
222222

223223
RESULT_LOCK = threading.Lock()
224224

225+
BUFSIZE = 256 * 1024 * 1024 # 256MiB
226+
225227
# Based on shutil's code
226-
def copyfileobj(fsrc, fdst, callback, length=shutil.COPY_BUFSIZE):
228+
def copyfileobj(fsrc, fdst, callback, length=BUFSIZE):
227229
try:
228230
# check for optimisation opportunity
229231
if "b" in fsrc.mode and "b" in fdst.mode and fsrc.readinto:
@@ -242,7 +244,7 @@ def copyfileobj(fsrc, fdst, callback, length=shutil.COPY_BUFSIZE):
242244
fdst_write(buf)
243245
callback(len(buf))
244246

245-
def _copyfileobj_readinto(fsrc, fdst, callback, length=shutil.COPY_BUFSIZE):
247+
def _copyfileobj_readinto(fsrc, fdst, callback, length=BUFSIZE):
246248
"""readinto()/memoryview() based variant of copyfileobj().
247249
*fsrc* must support readinto() method and both files must be
248250
open in binary mode.

0 commit comments

Comments
 (0)