ARM-software / MDK-Middleware

MDK-Middleware (file system, network and USB components) source code for Arm Cortex-M using CMSIS-Drivers and CMSIS-RTOS2 APIs.
https://arm-software.github.io/MDK-Middleware/
99 stars 25 forks source link

Improve ffind() performance when searching files in subfolders #72

Open andbararm opened 1 month ago

andbararm commented 1 month ago

When doing a wildcard search in a sub-folder:

  ffind( "directory\\file_42*", &fs_info ) ;

the time it takes to find a hit takes considerably longer than when first changing the current directory to the folder ffind() shall browse:

  fchdir( "directory" ) ;
  ffind( "file_42*", &fs_info ) ;

When ffind() looks in a sub-folder as in the first example, one can see in the Event Recorder debug output of the FileSystem library a "PathProcessing" for each entry in the folder looked at, but always with the same path. It seems, the library enters and leaves the sub-folder for every checked file entry in there. So, could there be some room for optimization?