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

Moderator: igrr

User avatar
By RogerClark
#42378 Martin

Thanks

I'll need to write some totally standalone code and do the timings again, but I'm not running any interrupts, so I can't see how that would make much difference.

The SPIFFS file are written using code, i.e the code downloads the command files and stores them in spiffs, so I suppose this could be related to how the file was written, but I'm pretty sure I had slow file access when I was using the SPIFFS as a web server from files uploaded using mkspiffs and the esptool

I'll need to do more testing

PS. I'm still getting intermittent crashes, which only seem to have happened when I stated to use SPIFFS in the code, but I've also added the use of the Time class (NTP), so its possible it is doing something unexpected
User avatar
By martinayotte
#42384 Hi Roger,
I've added the small benchmark test to my Sketch_Buffet :

Code: Select all    File f = SPIFFS.open("somefile.txt", "r");
    if (!f) {
      String str = "Can't open file !\r\n";
      Serial.println(str);
    }
    else {
      char buf[1024];
      long start = millis();
      long siz = f.size();
      String str = String("FileSize=") + siz;
      while(siz > 0) {
        size_t len = std::min((long)(sizeof(buf) - 1), siz);
        f.read((uint8_t *)buf, len);
        buf[len] = 0;
//        Serial.println(buf);
        siz -= sizeof(buf) - 1;
      }
      f.close();
      str += String(" / elapsedTime=") + (millis() - start) + "ms";
      Serial.println(str);
    }


and results are quite amazing, reading the 100K file in less than 100ms :

Code: Select allFileSize=97485 / elapsedTime=89msec


Of course, if I uncomment the print to Serial, it is becoming much slower :

Code: Select allFileSize=97485 / elapsedTime=8500ms