Append to file takes a while - please suggest a better design #9541
Unanswered
krishnak
asked this question in
Using MicroPython
Replies: 2 comments 1 reply
-
Just a thought ... I log to ramdisk every minute and every hour update to the wanted log file in flash. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Opening a file, takes time and flushing takes also time. I tested it with an ESP32 (WROOM, 4 MiB Flash) The function
The results:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a general Logging code in ESP devices for programming, I am not trying to Log any sensor data yet.
I am using
The f.write alone takes 5 ms when the file is empty. This time grows to around 100ms when the file size is 50K, I rotate logs when they reach 50K.
I also looked at code suggested here by Peter
While his code is faster i.e 1.5ms when the file is empty,
but his solution also takes around 80ms when the file has grown, the time measure is just for the
await swriter.awrite('Hello file\n')
Is there a better way to handle this, so that my logging time is kept with in few milliseconds
Beta Was this translation helpful? Give feedback.
All reactions