Skip to content

UpdateClass - speedup flash erase/writes #7002

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 5 commits into from
Aug 10, 2022

Conversation

vortigont
Copy link
Contributor

This change seriously speeds up OTA image flashing process.
I was working on a esp32-flashz lib implementing compressed OTA updates and found that UpdateClass is really slow on image writes. Even slower than esptool over serial. Looks like the main issue is in slow per-sector erase cycles.

This change implements the following:

  • on partition writes try to use large block erase
  • skip writing empty blocks of data after erase (makes sense for sparse FS images)

It gives 2-3 times speedup for raw image writes. Suppose it also depends on flash chip used.

Tested with FW/FS images

OTA update Origin This PR This PR + zlib
esp32, fw, ~1MiB 23.6 s 9.8 s 10.1 s
esp32, fs, ~1.5MiB, 90% sparse 29.8 s 9 s 6 s
esp32-c3, fw, ~1MiB 15.2 s 9.2 s 9.1 s
esp32-c3, fs, ~1.5MiB, 90% sparse 10.2 s 4.1 s 2.5 s
esp32-s2, fw, ~1MiB 19.8 s 7.5 s 7.5 s
esp32-s2, fs, ~1.5MiB, 90% sparse 7.7 s 4.7 s 1.8 s

vortigont and others added 2 commits July 16, 2022 20:08
 - on flash writes try to use large block erase
 - skip writing empty blocks of data after erase
@SuGlider
Copy link
Collaborator

Very nice optimization @vortigont, I really liked it! Thanks!

@SuGlider SuGlider requested review from SuGlider and P-R-O-C-H-Y July 20, 2022 13:35
@SuGlider SuGlider self-assigned this Jul 20, 2022
@VojtechBartoska VojtechBartoska added this to the 2.0.5 milestone Jul 27, 2022
@Jason2866
Copy link
Collaborator

We use your PR in latest Tasmota Arduino esp32 framework. It does work well and we have got not a single issue regarding OTA since this change.
Well done and should be merged ASAP.

@vortigont
Copy link
Contributor Author

vortigont commented Aug 7, 2022

Thanks @Jason2866. Having a positive tests feedback from a projects like Tasmota is much appreciated.
Cheers!

@VojtechBartoska VojtechBartoska added the Status: Pending Merge Pull Request is ready to be merged label Aug 9, 2022
Copy link
Member

@P-R-O-C-H-Y P-R-O-C-H-Y left a comment

Choose a reason for hiding this comment

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

Thanks @vortigont for the PR 👍 ! Really nice speed improvement. Tested on ESP32+ESP32S3 with smaller sketch, but got upload time 30-40% faster 🚀

@SuGlider SuGlider merged commit 4647809 into espressif:master Aug 10, 2022
@vortigont vortigont deleted the updtr_spdp branch August 11, 2022 17:48
vortigont added a commit to vortigont/esp32-flashz that referenced this pull request Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Merge Pull Request is ready to be merged
Projects
Development

Successfully merging this pull request may close these issues.

5 participants