Uh oh!
There was an error while loading. Please reload this page.
perf: skip unnecessary main data read in _lx_nand_flash_sector_read - #65
Conversation
Merge changes ahead of the 202504 release
3a761e5 to
d5e9ecfCompared5e9ecf to
58dc81eComparerahmanih
commented
Jan 22, 2026
Hi @borlandong , |
rahmanih
commented
Jan 22, 2026
just one point, |
borlandong
commented
Jan 22, 2026
Hi @rahmanih, Done! I've changed the base branch to Thank you for reviewing! |
borlandong
commented
Jan 26, 2026
Hi @rahmanih Driver Implementation Requirement: This performance improvement depends on the LevelX NAND driver properly handling NULL pointers in the Specifically, the driver must:
Example implementation pattern: UINTlx_nand_flash_driver_pages_read(/* parameters */)
{
// Only read main data area if buffer is providedif (main_buffer!=NULL)
{
// Read main data area
}
// Only read spare data area if buffer is providedif (spare_buffer!=NULL)
{
// Read spare data area
}
returnLX_SUCCESS;
}Why this matters: The optimization works by passing NULL for Testing: My implementation has been tested on W25N01GV with a driver that properly handles NULL pointers, which is why I achieved the 3.5x read performance improvement. Could you please verify if the reference NAND driver implementation in the test environment handles NULL pointers correctly? If not, I can help update the driver implementation or provide additional documentation on this requirement. Thank you! |
rahmanih
commented
Feb 2, 2026
Hi @borlandong, working on it! |
borlandong
commented
Feb 4, 2026
Hi @rahmanih That's great news! Thank you for testing on STM32 + W25N01GV and confirming it works correctly. I appreciate you taking the time to update the simulator driver to support this change. Please let me know if you need any assistance or clarification during the implementation. Looking forward to seeing this merged! |
align the nand flash simulator against the PR eclipse-threadx#65 Tests: Total Test time (real) = 6.33 sec ~/work/git_repos/github/eclipse/levelx_rahmanih/test/cmake 3/3 Test eclipse-threadx#1: default_build_coverage::levelx_nand_flash_test ........ Passed 44.06 sec 100% tests passed, 0 tests failed out of 3
Uh oh!
There was an error while loading. Please reload this page.
Related Issue
Fixes#64
Problem Description
The
_lx_nand_flash_sector_readfunction currently reads both main data area and spare data area when matching logical sector numbers. This is unnecessary since only spare area data is needed for sector matching, resulting in severe performance degradation.Solution
This PR optimizes the sector read logic to:
Implementation Details
Modified function:
_lx_nand_flash_sector_readKey changes:
Driver requirement:
NAND flash drivers must check if the main data area pointer is NULL and skip reading the main data area in that case.
Performance Results
Tested on W25N01GV NAND Flash with LevelX + FileX stack:
Summary:
Testing
Breaking Changes
None. This is a pure performance optimization that maintains backward compatibility.
Additional Notes
This optimization is especially important for read-intensive applications. The 3.5x read performance improvement significantly enhances user experience.