Optimize OverlapIterator#53
Merged
MathiasKoch merged 2 commits intorust-embedded-community:masterfrom Jul 25, 2024
Merged
Conversation
MathiasKoch
approved these changes
Jul 25, 2024
Collaborator
MathiasKoch
left a comment
There was a problem hiding this comment.
This is a super nice improvement!
Thank you!
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In my project, I noticed that writing to flash was pretty slow, so I tried to trace it out, and I pin-pointed the culprit to the
OverlapIterator.This PR optimizes the
OverlapIteratorso that in my test case, writing a 400 kB file to flash went down from 204 s to 14 s !So basically, I went from unusable to good enough with just this change.
Note that to optimize the
OverlapIterator, it needs to know the start and end of theRegion, so I needed to add those the theRegiontrait. So this is a breaking change and will require a version bump.I'm not sure how do you prefer to handle this version bump ? Would you like me to include it in this PR ? (I propose to bump embedded-storage to 0.4.0)
For the record, my test case is running on a STM32F407 with an external SPI flash (W25Q32) handled by the
w25q32jvcrate (implementingembedded-storage) and formatted as FAT32 usingembedded-fatfs. The whole thing is running withembassyand I'm downloading the file thru HTTP on the ethernet port usingreqwless.