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

feat: Optimized fs walker and util.IsEmptyDir #9433

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

idsulik
Copy link
Contributor

@idsulik idsulik commented Jun 4, 2024

Description

  1. Optimized file system walker, it used to make 80k(in my case) IO operations, because in the condition util.IsEmptyDir was before !info.IsDir(), though there is no reason to make IO operation to check is the directory empty if it's not a directory.
  2. Optimized utils.IsEmptyDir, it used to fetch all information about the directory while we just need to check if it has anything in it, so now it fetches only name

User facing changes
before - It makes N extra IO operations, where N - is docker context files count
after - It doesn't make extra IO operations.

p.s. this changes optimized fs walker by 50% on my laptop

@ericzzzzzzz
Copy link
Contributor

@idsulik Thanks for the optimization!

@ericzzzzzzz ericzzzzzzz merged commit 64585c1 into GoogleContainerTools:main Jun 10, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants