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

Use os.(*File).ReadDir to improve performance #8

Merged
merged 1 commit into from
Sep 29, 2024

Conversation

apocelipes
Copy link
Contributor

os.(*File).ReadDir is usually 1~2x faster than os.(*File).Readdir if we only use dir-entry's Name(), Type() and IsDir() methods.

I tested with "cmd/gocodewalkerperformance", and it shows an overall 15% improvement in performance:

(proj/go is the golang/go repo, it includes 12k+ files.)

benchmark

@boyter boyter merged commit d8c8345 into boyter:master Sep 29, 2024
@boyter
Copy link
Owner

boyter commented Sep 29, 2024

Very nice. I had a few other tweaks I was looking to get in for this, but this might be good enough to push out a release.

@apocelipes apocelipes deleted the feat/use-ReadDir branch September 30, 2024 05:31
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