GH-119169: Slightly speed up `os.walk(topdown=True)` by barneygale · Pull Request #121431 · python/cpython
When `os.walk()` traverses into subdirectories in top-down mode, call `os.path.join()` once to add a trailing slash, and use string concatenation thereafter to generate child paths.
barneygale
changed the title
GH-119186: Slightly speed up
GH-119169: Slightly speed up os.walk(topdown=True)os.walk(topdown=True)
lkollar pushed a commit to lkollar/cpython that referenced this pull request
…121431) pythonGH-119186: Slightly speed up `os.walk(topdown=True)` When `os.walk()` traverses into subdirectories in top-down mode, call `os.path.join()` once to add a trailing slash, and use string concatenation thereafter to generate child paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters