Very slow FATFS write on ESP32 v ESP8266.
Posted: Sat Jul 24, 2021 9:57 pm
Running the same code on ESP8266 and ESP32 shows a write time over 50 times slower on ESP32 when writing a 100 line file to FATFS.
The ESP32 timing is the same with a can.stop command.
I have attached the test file I was using for this.
ESP8266
Started at 22:53:26 on 24/07/21
Reading file
Writing file
Read time : 2.069 seconds.
Write time : 0.393 seconds.
ESP32
Started at 22:52:31 on 24/07/21
Reading file
Writing file
Read time : 1.4 seconds.
Write time : 16.382 seconds.
The ESP32 timing is the same with a can.stop command.
I have attached the test file I was using for this.
ESP8266
Started at 22:53:26 on 24/07/21
Reading file
Writing file
Read time : 2.069 seconds.
Write time : 0.393 seconds.
ESP32
Started at 22:52:31 on 24/07/21
Reading file
Writing file
Read time : 1.4 seconds.
Write time : 16.382 seconds.
Code: [Local Link Removed for Guests]
wlog chr$(10)
wlog "Started at " + Time$ + " on " + Date$
EOL$ = chr$(10)
FName$ = "/testfile.txt"
dim MyArray$(100)
gosub ReadFile
gosub WriteFile
readtime$ = str$((TEndRead - TStartRead) /1000)
writetime$ = str$((TEndWrite - TStartWrite)/1000)
wlog "Read time : " + readtime$ + " seconds."
wlog "Write time : " + writetime$ + " seconds."
end
ReadFile:
wlog "Reading file"
TStartRead = millis
for FCnt = 1 to 100
FLine$ = file.read$(FName$,FCnt)
MyArray$(FCnt) = FLine$
next FCnt
TEndRead = millis
return
WriteFile:
wlog "Writing file"
x = file.delete(FName$)
TStartWrite = millis
for FCnt = 1 to 100
FLine$ = MyArray$(FCnt) + EOL$
file.append FName$,FLine$
next FCnt
TEndWrite = millis
return