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.
This is a continuation of #85 and containers/common#82
TL;DR: This adds a parallel wrapper on top of
filetree.Walk(), enabling multiple callbacks to be used concurrently. This is proven to speed things up. The resulting implementation is used forChcon(), making it about 1.5x faster.Please see more in commit messages. For previous discussions, see the abovementioned PRs.
NOTE that this is not as fast as #85. The reason is we use standard
filepath.Walk()here, which performs the (unneeded)os.Stat()call on every entry, and also sorts the directory entries (which also does not make sense in many cases). So, yes, we can do better, but that means either another third-party package (such as github.com/karrick/godirwalk) or rewriting the filepath.Walk() from scratch. I'm still on the verge as whether we should do it, and am open to any suggestions.