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 have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
I have searched the issue tracker for a similar issue and not found a similar issue.
General issue report
Hi. I'm using NVS to save device data, and have speed problem when update to latest verion of IDF.
When IDF version 5.2.1, nvs_* works very fast.
nvs_set_* over 10 times each create
I (71606) device: Child created
I (71656) device: Child created
I (71746) device: Child created
I (71796) device: Child created
nvs_erase_* over 10 times each delete
I (37796) device: Child deleted
I (37816) device: Child deleted
I (37826) device: Child deleted
I (37846) device: Child deleted
When IDF version to 5.3.2 and 5.4, nvs_* works very slow
nvs_set* over 10 times each create
I (192097) device: Child created
I (192507) device: Child created
nvs_erase_* over 10 times each delete
I (101024) device: Child deleted
I (101864) device: Child deleted
I (102704) device: Child deleted
I (103554) device: Child deleted
I (104404) device: Child deleted
Enable/disable NVS_ALLOCATE_CACHE_IN_SPIRAM not affect.
Everythings is same but not IDF version.
Can you help me with this?
Thanks.
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
nvs_* getting slower updage from 5.2.1 to 5.3 or 5.4
nvs_* getting slower updage from 5.2.1 to 5.3 or 5.4 (IDFGH-14424)
Jan 14, 2025
Hi @GuGu927 ,
Could you please provide the code snippet showing how is the NVS called and how are you measuring the time elapsed in the operation. And, if possible, also the actual number of entries already stored in NVS during the test ?
Hi @rrtandler ,
I'm using ESP32S3 N8R8.
Here's code flow of mine.
esp_err_t set_storage_bool(nvs_handle_t *handle, const char *key, bool value)
{
esp_err_t err = nvs_set_u8(*handle, key, (uint8_t)value);
if (err != ESP_OK)
{
}
else
my_commit(handle);
return err;
}
esp_err_t get_storage_bool(nvs_handle_t *handle, const char *key, bool *value)
{
uint8_t nvs_value;
esp_err_t err = nvs_get_u8(*handle, key, &nvs_value);
if (err != ESP_OK)
{
return err;
}
*value = (bool)nvs_value;
return err;
}
void my_commit(nvs_handle_t *handle)
{
// Loop the handle list, and if it exists, try `vTaskDelete`. After that, call `xTaskCreate`.
// Commit the task after some seconds. This prevents `nvs_commit` from happening multiple times at the same time.
}
esp_err_t save_device()
{
set_some_nvs_blob()
my_commit()
}
my_device_t *create_device()
{
realloc device list
get_some_nvs_value() != ESP_OK then set_some_nvs_value()
get_some_nvs_value() != ESP_OK then set_some_nvs_value()
get_some_nvs_value() != ESP_OK then set_some_nvs_value()
...
printf("Device created");
save_device(my_device);
return my_device;
}
Data comes in.
Check for loop and try to create my virtual device.
Reallocate memory for the device list.
Attempt nvs_get_* for many (5–20) properties of the device being added. If a value is missing, set it using nvs_set_*.
(When first booting, devices are loaded from NVS, so the flow always tries both nvs_get_* and nvs_set_* simultaneously.)
At the very end, use printf to output "device created," then save the device.
Check data.
After every nvs_set, a my_commit is attempted.
In IDF version 5.2.1, the interval shown by printf in the console time is in the tens of milliseconds.
In IDF version 5.3.X and 5.4, the interval shown by printf in the console time is in the hundreds of milliseconds.
If you need any additional information, please don't hesitate to ask. I can provide detailed reproduction steps or logs if necessary. Thank you for reviewing this issue, and I look forward to your feedback.
Answers checklist.
General issue report
Hi. I'm using NVS to save device data, and have speed problem when update to latest verion of IDF.
When IDF version 5.2.1, nvs_* works very fast.
nvs_set_* over 10 times each create
I (71606) device: Child created
I (71656) device: Child created
I (71746) device: Child created
I (71796) device: Child created
nvs_erase_* over 10 times each delete
I (37796) device: Child deleted
I (37816) device: Child deleted
I (37826) device: Child deleted
I (37846) device: Child deleted
When IDF version to 5.3.2 and 5.4, nvs_* works very slow
nvs_set* over 10 times each create
I (192097) device: Child created
I (192507) device: Child created
nvs_erase_* over 10 times each delete
I (101024) device: Child deleted
I (101864) device: Child deleted
I (102704) device: Child deleted
I (103554) device: Child deleted
I (104404) device: Child deleted
Enable/disable NVS_ALLOCATE_CACHE_IN_SPIRAM not affect.
Everythings is same but not IDF version.
Can you help me with this?
Thanks.
The text was updated successfully, but these errors were encountered: