Skip to content

feat: Optimized fs walker and util.IsEmptyDir#9433

Merged
ericzzzzzzz merged 1 commit intoGoogleContainerTools:mainfrom
idsulik:walker-optimization
Jun 10, 2024
Merged

feat: Optimized fs walker and util.IsEmptyDir#9433
ericzzzzzzz merged 1 commit intoGoogleContainerTools:mainfrom
idsulik:walker-optimization

Conversation

@idsulik
Copy link
Copy Markdown
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
Copy Markdown
Contributor

@idsulik Thanks for the optimization!

@ericzzzzzzz ericzzzzzzz merged commit 64585c1 into GoogleContainerTools:main Jun 10, 2024
@menahyouyeah menahyouyeah mentioned this pull request Mar 3, 2026
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