Skip to content

SPIFFS file access slow on 16/14M flash config #5932

Closed
@TD-er

Description

@TD-er

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: [ESP-12]
  • Core Version: [c0eb301] (core 2.6.0 SDK 2.2.2)
  • Development Env: [Platformio]
  • Operating System: [Windows]

Settings in IDE

  • Module: [Generic ESP8266 Module|Wemos D1 mini pro]
  • Flash Mode: [dio]
  • Flash Size: [16MB]
  • lwip Variant: [v2 Lower Memory_low_flash]
  • Reset Method: [nodemcu|manual]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [OTA|SERIAL] (both)
  • Upload Speed: [115200] (serial upload only)

Problem Description

Open file from SPIFFS is quite a bit slower when using 16M/14M flash layout, compared to the same code running on the same node with 4M/1M as flash layout.

I am running a test setup on ESPeasy using the full 16M flash and thus 14M SPIFFS (want to keep using OTA).
Serving any web page is notably slower (1.7 sec compared to 300 msec).
After some debugging, it became clear that opening files from the SPIFFS was taking a lot longer.

Description Function #calls call/sec min (ms) Avg (ms) max (ms)
Load File 4M   16712 2.40 1.139 3.167 23.190
Load File 16M   8 0.01 1.329 93.900 248.736

And indeed, I do some checks for files on the SPIFFS while serving the web pages.
These checks are not really that efficient (try open instead of check first if it exists), so I will change that.

But still the access times to the SPIFFS are significantly slower when using 16M flash.
In PlatformIO I use:

board                     = esp12e
build_flags               = -Wl,-Tesp8266.flash.16m14m.ld

This behaves the same when using board = d1_mini_pro as suggested here

These are the detected flash settings:

Param value
Flash Chip ID: Vendor: 0xEF Device: 0x4018
Flash Chip Real Size: 16384 kB
Flash IDE Size: 16384 kB
Flash IDE Speed: 40 MHz
Flash IDE Mode: DIO
Flash Writes: 6 daily / 6 boot
Sketch Size: 946 kB (1100 kB free)
SPIFFS Size: 13579 kB (13504 kB free)
Page size: 256
Block size: 8192
Number of blocks: 1697
Maximum open files: 5
Maximum path length: 32

It is apparently using these settings:

PROVIDE ( _SPIFFS_start = 0x40400000 );
PROVIDE ( _SPIFFS_end = 0x411FB000 );
PROVIDE ( _SPIFFS_page = 0x100 );
PROVIDE ( _SPIFFS_block = 0x2000 );

I have not yet tested to see if performance improves when increasing the block size.
Increasing SPIFFS_MAX_OPEN_FILES to 20 doesn't seem to make any difference. (was hoping the FD cache would also increase)

Or maybe any other tweak suggestions here?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions