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

all: Avoid os.Lstat calls on every traversal #5724

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

Gofastasf
Copy link
Contributor

filepath.Walk calls os.Lstat for every file or directory to retrieve os.FileInfo.

filepath.WalkDir avoids unnecessary system calls since it provides a fs.DirEntry, which includes file type information without requiring a stat call.

This improves performance by reducing redundant system calls.

filepath.Walk calls os.Lstat for every file or directory to retrieve os.FileInfo.
filepath.WalkDir avoids unnecessary system calls since it provides a fs.DirEntry,
which includes file type information without requiring a stat call.

This improves performance by reducing redundant system calls.
Copy link
Collaborator

@a-nogikh a-nogikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@a-nogikh a-nogikh added this pull request to the merge queue Jan 30, 2025
Merged via the queue into google:master with commit 9c8ab84 Jan 30, 2025
17 checks passed
@Gofastasf Gofastasf changed the title all: replace Walk with WalkDir to reduce os.Lstat calls all: Avoid os.Lstat calls on every traversal Feb 14, 2025
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.

2 participants