Skip to content

Optimize OverlapIterator #53

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

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

aurelj
Copy link
Contributor

@aurelj aurelj commented Jun 14, 2024

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 OverlapIterator so 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 the Region, so I needed to add those the the Region trait. 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 w25q32jv crate (implementing embedded-storage) and formatted as FAT32 using embedded-fatfs. The whole thing is running with embassy and I'm downloading the file thru HTTP on the ethernet port using reqwless.

Copy link
Collaborator

@MathiasKoch MathiasKoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a super nice improvement!
Thank you!

@MathiasKoch MathiasKoch merged commit 95861f8 into rust-embedded-community:master Jul 25, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants