You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Excessive flash writing is occurring when using a FileStream for writing to a file in small chunks (e.g. serialising JSON data directly to a file stream). The behaviour is as if SPIFFS write caching isn't working at all.
Investigation shows that FileStream::write calls fileSeek before a fileWrite to ensure the data is written to the end of a file. The problem is that SPIFFS_lseek flushes the write cache, every time.
Removing the call to fileSeek fixes the problem and performance is restored. However, that's probably too simple as a proper fix as we'd potentially lose position tracking. Maybe arrange things so that fileSeek is only called if the file position has been changed, e.g. by another seek or read operation.
The text was updated successfully, but these errors were encountered:
The same thing will happen for anyone using the fileXXX API or SPIFFS directly. My feeling is that this is generally undesirable behaviour and SPIFFS could probably do with looking at.
Excessive flash writing is occurring when using a
FileStream
for writing to a file in small chunks (e.g. serialising JSON data directly to a file stream). The behaviour is as if SPIFFS write caching isn't working at all.Investigation shows that
FileStream::write
callsfileSeek
before afileWrite
to ensure the data is written to the end of a file. The problem is thatSPIFFS_lseek
flushes the write cache, every time.Removing the call to
fileSeek
fixes the problem and performance is restored. However, that's probably too simple as a proper fix as we'd potentially lose position tracking. Maybe arrange things so thatfileSeek
is only called if the file position has been changed, e.g. by another seek or read operation.The text was updated successfully, but these errors were encountered: