Hiho.
I'm not sure if it is possible to decrease loading times in my program, or if I just have to switch to SSDs. But maybe someone has an Idea :)
I'm getting the first (max) 100 files from a large number of folders and write their path to a single list. The problem is that it takes ages to load this list because I always get the whole content of the folder to a temporary list and then write the first 100 entries of that temporary list to my final list. Maybe it is faster if I could skip this extra step but I'm not sure if this is possible and if this would make any difference.
My code looks like this:
foreach (string Folder in FolderList)
{
List<string> FileListTMP = new List<string>();
FileListTMP.AddRange(Directory.GetFiles(Folder));
int i = 0;
while (i < FileListTMP.Count && i < 100)
{
FileList.Add(FileListTMP[i]);
i++;
}
}
It would be great if there is a solution to my problem because the number of folders is always growing and the loading times are already around 20 seconds long. :)
More info: At this time there are around 1500 folders. There are not more than 1000 files in a single folder. The average is about 500 files per folder.