diff options
author | Inada Naoki <methane@users.noreply.github.com> | 2019-03-02 13:31:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-02 13:31:01 +0900 |
commit | 4f1903061877776973c1bbfadd3d3f146920856e (patch) | |
tree | e9ef1a128bbee617b497bedfa52c583d36b48562 /Doc | |
parent | bcfa450f210074e16feb761ae5b3e966a2532fcf (diff) | |
download | cpython-git-4f1903061877776973c1bbfadd3d3f146920856e.tar.gz |
bpo-36103: change default buffer size of shutil.copyfileobj() (GH-12115)
It is changed from 16KiB to 64KiB. The previous default value
is used since 1990.
coreutils chose 128 KiB as minimum buffer size for block device I/O.
But shutil.copyfileobj() can be used for non block devices.
So I choose more conservative value.
As my quick benchmark, performance difference between 64KiB and
128 KiB is up to ~5%. On the other hand, performance difference
between 32 KiB and 64 KiB can be more than 10% when file is fully
buffered.
This is why 64 KiB is rational value.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/shutil.rst | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index 79d6bd4a06..587be3befa 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -424,7 +424,7 @@ On Linux, Solaris and other POSIX platforms where :func:`os.sendfile` supports copies between 2 regular file descriptors :func:`os.sendfile` is used. On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB -instead of 16 KiB) and a :func:`memoryview`-based variant of +instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil.copyfileobj` is used. If the fast-copy operation fails and no data was written in the destination |