Flash read performance

FaRe0001
Posts: 2
Joined: Tue Feb 11, 2025 8:11 am

Flash read performance

Postby FaRe0001 » Tue Feb 11, 2025 9:18 am

Hi all,

I have tried running some benchmarks for flash read performance on my esp32-s3, and noticed that

Code: Select all

esp_flash_read
performs about 30% slower than

Code: Select all

esp_flash_read_encrypted
I observed the same behavior when using

Code: Select all

esp_partition_read
and comparing performance with and without flash encryption.

Reference code below, used the same setup for esp_flash_read:

Code: Select all

     
    #define NUM_BLOCKS 64
    void test_flash_read_plaintext(size_t block_size) { 
    	uint8_t *flash_buffer = (uint8_t *)malloc(block_size);
    	const esp_partition_t *partition = get_partition_to_test();
    
    	start_time = esp_timer_get_time();
    	for (int i = 0; i < NUM_BLOCKS; i++) {
        	esp_flash_read_encrypted(NULL,partition->address + i * block_size, flash_buffer, block_size);
    	}
        end_time = esp_timer_get_time();
        
        printf("esp_flash_read: %llu microseconds", (end_time - start_time)/NUM_BLOCKS;
   }
What could be the reason for this difference in performance?

FaRe0001
Posts: 2
Joined: Tue Feb 11, 2025 8:11 am

Re: Flash read performance

Postby FaRe0001 » Wed Feb 12, 2025 9:54 am

I got the previous results reading 4096 byte blocks.
When reading 32 byte blocks "esp_flash_read" performs much better, as would likely be expected.

Who is online

Users browsing this forum: dnzssrl, jhinkle and 110 guests