[issue33695] Have shutil.copytree(), copy() and copystat() use cached scandir() stat()s

Giampaolo Rodola' report at bugs.python.org
Wed Aug 1 20:16:31 EDT 2018


Giampaolo Rodola' <g.rodola at gmail.com> added the comment:

I agree the provided benchmark on Linux should be more refined. And I'm not sure if "echo 3 | sudo tee /proc/sys/vm/drop_caches" before running it is enough honestly.

The main point here is the reduction of stat() syscalls (-38%) and that can make a considerable  difference, especially with network filesystems. That's basically the reason why scandir() was introduced in the first place and used in os.walk() glob.glob() and shutil.rmtree(), so I'm not sure why we should use a different rationale for shutil.copytree().

----------

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


More information about the Python-bugs-list mailing list