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
Listing the backend files for exFAT targets (may also apply to other FAT types) takes much longer than required. It is suspected this is due to unnecessary lookups of files by name.
Using DirectoryInfo to directly list the folder contents as FileInfo, this lookup is avoided and the list operation completes much faster (50 seconds instead of 1 hour for 110000 files).
ISystemIO should be updated to implement the more efficient method of listing.
Steps to reproduce
Create a folder on exFAT partition with 10000 - 100000 empty files
Create new backup with that folder as target
Run backup
Actual result:
File verify takes a long time (minutes to hours).
Expected result:
File verify should not take longer than a minute.
Test code
This code simulates two different methods of file access. It was discovered that accessing LastAccessTime or other metadata is the main reason for the slowdown.
stringpath=@"F:\test";intiterations=1;vartimeInfo= TimeSpan.Zero;vartimeListNames= TimeSpan.Zero;vartimeLookupNames= TimeSpan.Zero;varwatch= System.Diagnostics.Stopwatch.StartNew();for(inti=0;i<iterations;++i){// List files directly (current implementation)
watch.Restart();string[]files= System.IO.Directory.GetFiles(path);
watch.Stop();timeListNames+= watch.Elapsed;
watch.Start();varaccessTimes=(fromfileNameinfileslet fi =new System.IO.FileInfo(fileName)select fi.LastAccessTime).ToList();
watch.Stop();timeLookupNames+= watch.Elapsed;// List by DirectoryInfo
watch.Restart();varaccessTimes2=(fromfiinnew System.IO.DirectoryInfo(path).GetFiles()select fi.LastAccessTime).ToList();
watch.Stop();timeInfo+= watch.Elapsed;}
Console.WriteLine($"List only names: {timeListNames}\nList + lookup by name: {timeLookupNames}\nList DirectoryInfo: {timeInfo}");
Output with 17000 files
List only names: 00:00:00.0264646
List + lookup by name: 00:00:58.3627105
List DirectoryInfo: 00:00:00.0315012
The text was updated successfully, but these errors were encountered:
Environment info
Description
Listing the backend files for exFAT targets (may also apply to other FAT types) takes much longer than required. It is suspected this is due to unnecessary lookups of files by name.
Using
DirectoryInfo
to directly list the folder contents asFileInfo
, this lookup is avoided and the list operation completes much faster (50 seconds instead of 1 hour for 110000 files).ISystemIO
should be updated to implement the more efficient method of listing.Steps to reproduce
File verify takes a long time (minutes to hours).
File verify should not take longer than a minute.
Test code
This code simulates two different methods of file access. It was discovered that accessing
LastAccessTime
or other metadata is the main reason for the slowdown.Output with 17000 files
The text was updated successfully, but these errors were encountered: