Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve performance ofos.walk() #119169

Open
Labels
performancePerformance or resource usage
@barneygale

Description

@barneygale

There are a couple of minor performance improvements possible inos.walk():

  • We don't need to manually pump theos.scandir iterator, given we handle exceptions fromnext() like exceptions fromscandir() itself, i.e. by ignoring the problematic directory and moving on. We can use afor loop like filthy casuals.
  • In bottom-up mode, we can handle exceptions fromentry.is_symlink() in the same block as those fromentry.is_dir(), which avoids a few temporary variables.
  • In top-down mode, we can callos.path.join() once on a parent directory rather than for each child path.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance or resource usage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp