-
Notifications
You must be signed in to change notification settings - Fork 797
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
RFC: various optimization targeting 'rename' and "compact' (but not only...) #621
Open
invoxiaamo
wants to merge
7
commits into
littlefs-project:master
Choose a base branch
from
invoxiaamo:rename-opti
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Commits on Dec 1, 2021
-
cache: rcache optimization with conditional read ahead
Monitoring the lfs_bd_read usage during time consuming operations (eg. rename) shows a very large of uncache reads on small (less than cache size) consecutive offsets. Implementing a read ahead strategy when such consecutive reads are detective is an effective optimization.
Configuration menu - View commit details
-
Copy full SHA for f9f599f - Browse repository at this point
Copy the full SHA f9f599fView commit details -
Configuration menu - View commit details
-
Copy full SHA for caaf63b - Browse repository at this point
Copy the full SHA caaf63bView commit details -
utils: Measure performance of various IO and function calls
Enabled with LFS_PERF_STATS define
Configuration menu - View commit details
-
Copy full SHA for 593b616 - Browse repository at this point
Copy the full SHA 593b616View commit details -
Optimization of the rename case.
Rename can be VERY time consuming. One of the reasons is the 4 recursion level depth of lfs_dir_traverse() seen if a compaction happened during the rename. lfs_dir_compact() size computation [1] lfs_dir_traverse(cb=lfs_dir_commit_size) - do 'duplicates and tag update' [2] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[1]) - Reaching a LFS_FROM_MOVE tag (here) [3] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[1]) <= on 'from' dir - do 'duplicates and tag update' [4] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[3]) followed by the compaction itself: [1] lfs_dir_traverse(cb=lfs_dir_commit_commit) - do 'duplicates and tag update' [2] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[1]) - Reaching a LFS_FROM_MOVE tag (here) [3] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[1]) <= on 'from' dir - do 'duplicates and tag update' [4] lfs_dir_traverse(cb=lfs_dir_traverse_filter, data=tag[3]) Yet, analyse shows that levels [3] and [4] don't perform anything if the callback is lfs_dir_traverse_filter... A practical example: - format and mount a 4KB block FS - create 100 files of 256 Bytes named "/dummy_%d" - create a 1024 Byte file "/test" - rename "/test" "/test_rename" - create a 1024 Byte file "/test" - rename "/test" "/test_rename" This triggers a compaction where lfs_dir_traverse was called 148393 times, generating 25e6+ lfs_bd_read calls (~100 MB+ of data) With the optimization, lfs_dir_traverse is now called 3248 times (589e3 lfs_bds_calls (~2.3MB of data) => x 43 improvement...
Configuration menu - View commit details
-
Copy full SHA for d09dcda - Browse repository at this point
Copy the full SHA d09dcdaView commit details
Commits on Dec 10, 2021
-
Configuration menu - View commit details
-
Copy full SHA for ae1d454 - Browse repository at this point
Copy the full SHA ae1d454View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6f4fc80 - Browse repository at this point
Copy the full SHA 6f4fc80View commit details
Commits on Mar 25, 2022
-
Co-authored-by: GIldons <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for bf33e69 - Browse repository at this point
Copy the full SHA bf33e69View commit details
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.