builder: align file dump order with prefetch list, fix #1488 #1492
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.
Relevant Issue (if applicable)
If there are Issues related to this PullRequest, please list it.
Fix #1488
Details
Please describe the details of PullRequest.
Master:
Patch:
The construction of
Prefetch
is slow due to inefficient matching of prefetch patterns.For the build of patterns,
generate_patterns()
, the check whether current pattern is existed or covered by existing patterns inprefetch.patterns
, is changed from iterating every pattern to check whether the parent path have been recorded.For the build of
prefetch.files
, the rootfs tree is iterated in BFS only once inbuild_rafs()
, and then cached inPrefetch
to aviod duplicate BFS iteration inlayout_blob_simple()
.Unit tests for prefetch are added.
Thus the build time prefetching is accelerated. For the
nydusify convert
time of a single layer Wordpress image with a total of 14,916 files, out of which 3,205 are prefetching files,Master:
DirectoryToRafs: 19.13s
TarToRafs: 17.43s
Patch:
DirectoryToRafs: 7.08s
TarToRafs: 5.33s
Types of changes
What types of changes does your PullRequest introduce? Put an
x
in all the boxes that apply:Checklist
Go over all the following points, and put an
x
in all the boxes that apply.