[issue33414] Make shutil.copytree use os.scandir to take advantage of cached is_(dir|file|symlink)

Serhiy Storchaka report at bugs.python.org
Thu May 3 03:11:37 EDT 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Could you show an example that exposes a significant overhead of the current implementation?

There were reasons of using os.scandir() in os.walk() and glob.glob(). You may scan thousands of files and performs a heavy I/O only with few of them. There was smaller reason of using it in shutil.rmtree() -- removing an entry from the directory is fast, but likely you will spent much more time for creating a tree.

But I don't know reasons of using it in shutil.copytree() in which you need to performs a heavy I/O with every file and directory.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33414>
_______________________________________


More information about the Python-bugs-list mailing list