Skip to content

Optimize OverlapIterator#53

Merged
MathiasKoch merged 2 commits intorust-embedded-community:masterfrom
aurelj:iter_optimize
Jul 25, 2024
Merged

Optimize OverlapIterator#53
MathiasKoch merged 2 commits intorust-embedded-community:masterfrom
aurelj:iter_optimize

Conversation

@aurelj
Copy link
Copy Markdown
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
Copy Markdown
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
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