Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate os.listdir() to os.scandir() to increase performance #78

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xsuchy
Copy link

@xsuchy xsuchy commented Jan 17, 2025

@xsuchy
Copy link
Author

xsuchy commented Jan 17, 2025

I did very simple and trivial benchmark on walking through the kernel tree:

  • previously: 45 second
  • after this PR: 36 second

@xsuchy
Copy link
Author

xsuchy commented Jan 17, 2025

If this gets merged, I will open another PR for the remaining occurrences of listdir() in other functions.

As recommended in https://peps.python.org/pep-0471/

Signed-off-by: Miroslav Suchý <msuchy@redhat.com>
@xsuchy
Copy link
Author

xsuchy commented Jan 29, 2025

Any review comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant