Replies: 6 comments 13 replies
-
Thank you for this. I've added profiling to the sample. (This and other stuff will end up in the test application I suspect.) You're right about the cost/benefit of double-writing. It could be useful for debugging at some point, but have removed it for now: can always add it back with an option flag if needed later. Here's what I get with two runs of the sample, for comparison. Wipe flash before each run for consistency ( Normal store saving:
With file double-writing added back in:
|
Beta Was this translation helpful? Give feedback.
-
as a general thought here: could the commit() call be asynchronous or maybe have an asynchronous version? |
Beta Was this translation helpful? Give feedback.
-
Most of the time will be due to flash erase. The ideal backing store would only need to erase when required, so most commits would only perform a flash write which is much faster. This isn't how LittleFS works though. So if you need this to work faster then a different filing system is required; I briefly talked about this here https://github.com/mikee47/IFS#configuration-filesystem. The esp-idf NVS component is essentially a flash-based database specifically for lots of small values. I attempted a port to Sming https://github.com/mikee47/Sming-NVS but it's just too complicated and requires too much RAM for the esp8266. My preference would be to start from scratch and write it in C++, but the principle is sound. |
Beta Was this translation helpful? Give feedback.
-
As for 'asynchronous' well it's got to do a commit sometime and it's really got to be down to the application when that happens. It could be handled using a |
Beta Was this translation helpful? Give feedback.
-
I think it's not so much about speed but about blocking a thread for almost half a second. But it might just be something I think of as problematic. After all, in my case, this will almost always be in a code path that started with a http request, so it's "slow" by definition. In other situations, like when storing time series data, I don't envision this to be called in ms intervals either as that would surely overwhelm storage quickly. (maybe there should be a note on performance and flash life time in the docs later) |
Beta Was this translation helpful? Give feedback.
-
Time series data can you elaborate? |
Beta Was this translation helpful? Give feedback.
-
I'll just drop a few notes and findings here for us to work on
so I tried to look at performance a bit:
trying to assess what to expect from this.
In it's current form (with double buffered writes, so the .new / .old files), a commit takes between 500 and 700ms, that's a lot of time if it has to be a synchronous call.
Removing the double buffering, this comes down to 400-500ms which is still a long time, but better.
This tells me that commits should really only be once all changes to a store have been made.
On the double buffering: as said in the issue earlier, I'm not sure that's something I want to do as I believe it costs more than it brings benefits:
Beta Was this translation helpful? Give feedback.
All reactions