micropython / micropython/micropython
ESP32(S3) - littlefs - Consistant drop of module loading speed if files are written to filesystem
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 22.1k
- Forks
- 9k
- Avg merge
- 6d 4h
- Merged PRs (30d)
- 16
Description
Greetings all,
the past two days i am troubled by a weird behaviour pattern that I was not able to find any answer, so I am posting it here hopping to find a solution.
- board: ESP32-S3-WROOM-1 and ESP32-WROVER-IE
- micropython: 1.16, 1.19.1, 1.21
- file system: littlefs v2
I am running a very simple script.
The scenario is to wake up, write content to a file, load a module and deepsleep.
My observation is that every time a file is written to the file system, the system speed is affected in a consistant pace. After each wakeup from deep sleep, running the same script takes more and more time to execute. At some point it starts executing the scirpt quickly again and starts gradually the speed slow down.
This is the main.py where at the end of the module import, before going to sleep just prints the ticks_ms to use as reference:
import utime
destination = "/testing"
content = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
with open(destination, "w") as file:
file.write(content)
from onewire import OneWire
from ds18x20 import DS18X20
print("load time: {}".format(utime.ticks_ms()))
utime.sleep_ms(1000)
import machine
machine.deepsleep(1)
And here is the behaviour in multiple setups shown in graphs, where the Y axis is the execution time printed by the line print("load time: {}".format(utime.ticks_ms())) and the X axis is the iteration number:
-
ESP32-S3-WROOM-1 (micropython 1.21.0) - littlefs v2
-
ESP32-S3-WROOM-1 (micropython 1.19.1) - littlefs v2
-
ESP32-WROVER-IE (micropython 1.16) - littlefs v2
-
ESP32-S3-WROOM-1 (micropython 1.19) - fat
Notes
- This has to do with the littlefs somehow. fat does not have this behaviour
- The loading time is directly dependand to some state of the file system because even after a power off/on, the loading speed follows exactly the pattern from where it was before power off.
- Different content length when writting, affects the rythm of speed decline
An help will be very much appreciated as I have hit a deadend to my investigation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied main.py reproducer and compare its ticks_ms output across repeated deep-sleep cycles using littlefs v2 and FAT, including the listed MicroPython versions and boards. Done means identifying the filesystem condition associated with the slowdown and documenting or resolving the difference from FAT.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100