Skip to content

Open speed and cache sizes #783

Open
@bitzer-tjo

Description

@bitzer-tjo

Hi

We have done a lot of performance test with LittleFS and some of the results don’t add up. Maybe someone can tell the why this is so and explain what we see.
We are using a STM32 H7 and a Micron Data flash running with a 66 MHz SPI clock.
We use LittleFS 2.4.5 but have tried with the latest 2.5.1 and the result is somehow similar. But it is a bit faster, and chop offs a few 100 ms. where file creation is worst.

File creation time (Open and Sync)
We have concentrated about file creation times (So an open and sync). We tested with different cache/prog sizes and file sizes. We created 100 files in the root folder and measured the time in milliseconds for doing an open and sync. Then we write data to the file and close it. Then create a new until we reach 100 files. If we tested with 128 file size, 128 byte was written to each file.
As expected, the file creation time goes up when more and more files are in the folder. But some of the create time takes like seconds to do. I have checked, the time is not used in the data flash driver. This also changes on the file sizes and cache size.
Some measurements with file size 0, 128, 256 and 512 bytes

file creation 0 size
file creation 128 byte size
file creation 256 byte size
file creation 512 byte size

All above 512 bytes looks the same. Even if every file has a size of 11KB
For file size 0, there are some spikes and file no 92 takes almost 1.4 seconds.
If the file size is the cache buffer size, it seems to perform very well, but outside we se these spikes!
File size above 512 file no 81 takes more than 3.5 seconds. (Up until 11 KB file size)
Ran with this config.
Block size: 4_KB
Read size: 32
Program size 256
Lookahead size 256
Cache size 256
Why do we see this? Is there a good explanation?

Here is the same teste but with different cache sizes. With higher cache size we got frequently more spikes?

File creation vs cache size

Cache and program buffer size impact:
When we look at the cache and program buffer sizes, we see this. Same test but I just log the time for the file that toke the longest to create. Increment the file size with 32 bytes for each loop.
Pseudo code:
Loop until file size is 1 KB
Format
Mount
Loop 100 times: Start time – open – sync – diff time – write file size data to file – close – Long highest diff
Increment file size with 32 bytes

worst cache 256
worst cache 512 bytes

Is this what to excpet?

Best regards
Thomas

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions