[issue44579] shutil.copy() inefficient implementation in Windows

2021-07-07 Thread Eryk Sun


Change by Eryk Sun :


--
components: +Windows -Library (Lib)

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44579] shutil.copy() inefficient implementation in Windows

2021-07-07 Thread Steve Dower


Steve Dower  added the comment:

> Note that CopyFileEx() is a high-level Windows API function, not a "kernel 
> mode" copy.

This is true today, but could change whenever Windows feels like changing it. 
If we switch to the native API then we'll get any advantage there automatically.

The only challenge is in managing changes to semantics (that is, anything extra 
we do to "match" Unix that isn't normally how copies work on Windows - 
personally, I'd rather be more native on Windows anyway).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44579] shutil.copy() inefficient implementation in Windows

2021-07-07 Thread Eryk Sun


Eryk Sun  added the comment:

> In Windows there is an fast API to copy file in kernel mode: CopyFile

The possibility of calling CopyFileEx() for shutil.copy2() is discussed in 
issue 30044. Note that CopyFileEx() is a high-level Windows API function, not a 
"kernel mode" copy. It opens the source and destination files and makes 
multiple system calls in order to copy file data and metadata (e.g. system 
calls such as NtOpenFile, NtCreateFile, NtReadFile, NtWriteFile, 
NtQueryInformationFile, NtSetInformationFile, NtQueryEaFile, NtSetEaFile, 
NtQuerySecurityObject, etc). This includes copying the primary data stream, 
alternate data streams, file attributes, extended file attributes, and security 
resource attributes.

--
components:  -Windows
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44579] shutil.copy() inefficient implementation in Windows

2021-07-07 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44579] shutil.copy() inefficient implementation in Windows

2021-07-07 Thread sfmc


New submission from sfmc :

In Windows shutil.copy() uses _copyfileobj_readinto which copies file in user 
mode.
In Windows there is an fast API to copy file in kernel mode: CopyFile (see 
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-copyfile).

--
components: Library (Lib)
messages: 397076
nosy: sfmc
priority: normal
severity: normal
status: open
title: shutil.copy() inefficient implementation in Windows
type: performance
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com