Skip to content

Commit c3166e1

Browse files
committed
update doc
1 parent f47c011 commit c3166e1

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Doc/library/shutil.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,10 @@ On macOS `fcopyfile`_ is used to copy the file content (not metadata).
412412
On Linux, Solaris and other POSIX platforms where :func:`os.sendfile` supports
413413
copies between 2 regular file descriptors :func:`os.sendfile` is used.
414414

415+
On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB
416+
instead of 16 KiB) and if file size >= 128 MiB a :func:`memoryview`-based
417+
variant of :func:`shutil.copyfileobj` is used.
418+
415419
If the fast-copy operation fails and no data was written in the destination
416420
file then shutil will silently fallback on using less efficient
417421
:func:`copyfileobj` function internally.

Doc/whatsnew/3.8.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ Optimizations
100100
"fast-copy" means that the copying operation occurs within the kernel,
101101
avoiding the use of userspace buffers in Python as in
102102
"``outfd.write(infd.read())``".
103-
Also, :func:`shutil.copyfile` default buffer size on Windows was increased
104-
from 16 KiB to 1 MiB.
103+
On Windows :func:`shutil.copyfile` default buffer size was increased
104+
from 16 KiB to 1 MiB and a faster implementation of :func:`shutil.copyfileobj`
105+
is used for files bigger than 128 MiB.
105106
The speedup for copying a 512 MiB file within the same partition is about
106107
+26% on Linux, +50% on macOS and +40% on Windows. Also, much less CPU cycles
107108
are consumed.

Misc/NEWS.d/next/Library/2018-05-28-23-25-17.bpo-33671.GIdKKi.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
:func:`shutil.copytree` and :func:`shutil.move` use platform-specific
33
fast-copy syscalls on Linux, Solaris and macOS in order to copy the file
44
more efficiently.
5-
Also, :func:`shutil.copyfile` default buffer size on Windows was increased
6-
from 16KiB to 1MiB. The speedup for copying a 512MiB file is about +26% on
7-
Linux, +50% on macOS and +40% on Windows. Also, much less CPU cycles are
8-
consumed (Contributed by Giampaolo Rodola' in :issue:`25427`.)
5+
On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB
6+
instead of 16 KiB) and if file size >= 128 MiB a :func:`memoryview`-based
7+
variant of :func:`shutil.copyfileobj` is used.
8+
The speedup for copying a 512MiB file is about +26% on Linux, +50% on macOS and
9+
+40% on Windows. Also, much less CPU cycles are consumed.
10+
(Contributed by Giampaolo Rodola' in :issue:`25427`.)

0 commit comments

Comments
 (0)