Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET Core 2.1 DirectoryInfo.EnumerateFiles() Performance is Slower than .NET Framework #1916

Closed
ONeill45 opened this issue Sep 4, 2018 · 2 comments

Comments

@ONeill45
Copy link

ONeill45 commented Sep 4, 2018

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:


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:

image

And then the results in .NET Core:

image

Can anyone help me understand why there is such a dramatic decrease in performance?

@MarcoRossignoli
Copy link
Member

better move to https://github.com/dotnet/corefx

/cc @JeremyKuhne, @pjanotti

@Petermarcu
Copy link
Member

Issue moved to dotnet/corefx #32098 via ZenHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants