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
I always thought reading a file should be really faster than writing. But I already tested it in several ESP32 boards I got in here and I am getting just the opposite result.
This is the code I am using:
#include "FS.h"
#include "SPIFFS.h"
void setup()
{
Serial.begin(115200);
delay(1000);
ulong ini, fin = 0;
if (!SPIFFS.begin(true)) {
Serial.println("SPIFFS Mount Failed");
}
else
{
//
// FORMAT
//
Serial.print("FORMAT: ");
ini = millis();
SPIFFS.format();
fin = millis();
fin = fin - ini;
Serial.println((String)fin + " millis");
String filename = "/test";
//
// CREATE FILE AND PUT SOME TEXT
//
Serial.print("CREATE / WRITE: ");
ini = millis();
File file = SPIFFS.open(filename, FILE_WRITE);
file.println("EXAMPLE TEXT CONTENT");
file.flush();
file.close();
fin = millis();
fin = fin - ini;
Serial.println((String)fin + " millis");
//
// READ FILE
//
Serial.print("READ: ");
String result = "";
ini = millis();
File file2 = SPIFFS.open(filename);
result = file2.readString();
fin = millis();
fin = fin - ini;
Serial.println((String)fin + " millis / result: " + result);
}
}
void loop()
{
delay(5000);
}
This is the Output I am getting:
FORMAT: 14508 millis
CREATE / WRITE: 156 millis
READ: 1001 millis / result: EXAMPLE TEXT CONTENT
I am assuming I am doing something (VERY) wrong, but just in case, I am anyway raising an issue!
Regards,
Enrique
The text was updated successfully, but these errors were encountered:
I am using latest ESP32 Arduino framework.
I always thought reading a file should be really faster than writing. But I already tested it in several ESP32 boards I got in here and I am getting just the opposite result.
This is the code I am using:
This is the Output I am getting:
I am assuming I am doing something (VERY) wrong, but just in case, I am anyway raising an issue!
Regards,
Enrique
The text was updated successfully, but these errors were encountered: