Directory.EnumerateFiles regressed in .NET 8 #110754
Labels
area-System.IO
tenet-performance
Performance related issue
untriaged
New issue has not been triaged by the area owner
Description
My team observed a regression for the performance of Directory.EnumerateFiles in .NET 8. We store a large number of database redo logs in a folder, named with a prefix and a log generation number (e.g., E10ABCD1234.log). Our goal is to determine the maximum log generation number efficiently.
To achieve this, we have developed a fast search algorithm that looks for the highest generation log files in a hierarchical manner, starting from E10F*******.log to E100*******.log and so on, until the last digit. We use Directory.EnumerateFiles(directory, filter) to detect matching files.
We compared the performance of our search algorithm against a direct enumeration of all files to get the maximum generation number.
Previously in .Net framework it uses FindFirstFile which takes the search filter to find out the first / next file.
This API changed in .Net Core/6/8 implementation,
runtime/src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Windows.cs at 6362f242fc6e3065948b3bf922406509cb721a73 · dotnet/runtime
Configuration
Regression?
Data
Analysis
The text was updated successfully, but these errors were encountered: