This repository was archived by the owner on Jun 3, 2025. It is now read-only.
Avoid redundant calls to filepath.Clean#2652
Merged
aaron-prindle merged 1 commit intoGoogleContainerTools:mainfrom Aug 1, 2023
Merged
Avoid redundant calls to filepath.Clean#2652aaron-prindle merged 1 commit intoGoogleContainerTools:mainfrom
aaron-prindle merged 1 commit intoGoogleContainerTools:mainfrom
Conversation
filepath.Clean shows up in profiles as a hot spot, and there seem to be
many redundant calls, particularly in ignorelist handling. We can avoid
these redundant calls by pre-cleaning entries in the ignore list, and
providing fast paths when we know we're already dealing with a cleaned
candidate path.
Before:
580ms 3.03% 72.35% 590ms 3.08% path/filepath.(*lazybuf).append (inline)
390ms 2.03% 74.39% 990ms 5.16% path/filepath.Clean
After:
0.13s 0.69% 84.01% 0.17s 0.91% path/filepath.(*lazybuf).append (inline)
0.13s 0.69% 84.70% 0.31s 1.65% path/filepath.Clean
afec798 to
406e502
Compare
aaron-prindle
approved these changes
Aug 1, 2023
Collaborator
aaron-prindle
left a comment
There was a problem hiding this comment.
Awesome, thanks for this @aaronlehmann! LGTM
aaron-prindle
added a commit
to aaron-prindle/kaniko
that referenced
this pull request
Aug 7, 2023
…Tools#2652)" This reverts commit 32ce1bf.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
filepath.Cleanshows up in profiles as a hot spot, and there seem to be many redundant calls, particularly in ignorelist handling. We can avoid these redundant calls by pre-cleaning entries in the ignore list, and providing fast paths when we know we're already dealing with a cleaned candidate path.Before:
After: