Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By andrew melvin
#31284 Beginning to do work with SPIFFS on the arduino IDE, and I have some questions....

I'm going to try and use SPIFFS instead of storing big arrays in RAM. I'm concerned with heap usage, and speed.

1) If i open a file, I use about 120Bytes of heap, so not much. is this really the overhead of having a file open?
2) Is having more than one file open at a time acceptable (Seems to maintain the 120bytes of heap, even 120bytes for 3 files) as writing to an open file is super fast, whereas .. see below..
3) Is it acceptable to open a file, and keep it open? are writes immediately saved... because close() takes around 3-4ms.

just wanting to know more about how it all works?

many thanks all
User avatar
By SPComputing
#31692 I can think of no good reason to keep a file open longer than the time it takes to write a record's worth of information. If open too long, something invariably happens and the file is corrupted.

Best wishes and good luck!
User avatar
By bbx10node
#32206 I did some performance testing that might be helpful. Writes are slow on a Huzzah board. Not sure if this true for all boards. Also the test runs out of free space even though the test file is removed between test cycles. I have not dug into the source code yet.

https://github.com/bbx10/esp-spiffs-test

Code: Select allSPIFFS Performance
49585 msecs
1048576 bytes
21147 write bytes/sec
2216 msecs
1048576 bytes
473184 read bytes/sec
SPIFFS Performance
write failed
SPIFFS Performance
open for write failed