On 13.02.15 12:07, Victor Stinner wrote:
TL,DR: are you ok to add 800 lines of C code for os.scandir(), 4x
faster than os.listdir() when the file type is checked?

You can try to make Python implementation faster if

1) Don't set attributes to None in constructor.

2) Implement scandir as:

def scandir(path):
    return map(partial(DirEntry, path), _scandir(path)).

3) Or pass DirEntry to _scandir:

def scandir(path):
    yield from _scandir(path, DirEntry)


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to