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
.NET Core 2.1 DirectoryInfo.EnumerateFiles() Performance is Slower than .NET Framework
General
I have a .NET Core 2.1 Web API that is being built as a replacement for an older .NET Framework MVC Web Application (.NET Framework 4.5).
One of the responsibilities of this application is to take in a directory and search template and return the top 10 results, ordered by most recent. This is being accomplished using System.IO.DirectoryInfo and the EnumerateFiles() method:
List<FileInfo> fileInfos = new DirectoryInfo(directory).EnumerateFiles(fileTemplate)
.OrderByDescending(f => f.LastWriteTime).Take(10).ToList();
However, I am noticing that this search is much, much slower in .NET Core than in .NET Framework. I created two console apps with the same code, one .NET Framework and one .NET core, to compare run times. Below are the results in .NET Framework:
And then the results in .NET Core:
Can anyone help me understand why there is such a dramatic decrease in performance?
The text was updated successfully, but these errors were encountered:
Issue Title
.NET Core 2.1 DirectoryInfo.EnumerateFiles() Performance is Slower than .NET Framework
General
I have a .NET Core 2.1 Web API that is being built as a replacement for an older .NET Framework MVC Web Application (.NET Framework 4.5).
One of the responsibilities of this application is to take in a directory and search template and return the top 10 results, ordered by most recent. This is being accomplished using System.IO.DirectoryInfo and the EnumerateFiles() method:
However, I am noticing that this search is much, much slower in .NET Core than in .NET Framework. I created two console apps with the same code, one .NET Framework and one .NET core, to compare run times. Below are the results in .NET Framework:
And then the results in .NET Core:
Can anyone help me understand why there is such a dramatic decrease in performance?
The text was updated successfully, but these errors were encountered: