FastDiskIO 1.0.1

dotnet add package FastDiskIO --version 1.0.1                
NuGet\Install-Package FastDiskIO -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FastDiskIO" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FastDiskIO --version 1.0.1                
#r "nuget: FastDiskIO, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FastDiskIO as a Cake Addin
#addin nuget:?package=FastDiskIO&version=1.0.1

// Install FastDiskIO as a Cake Tool
#tool nuget:?package=FastDiskIO&version=1.0.1                

FastDiskIO

A project providing fast disk IO operations

Disclaimer

The contained code is targeted for Windows devices.

Source code for the fast file enumeration was originally taken from https://www.codeproject.com/Articles/38959/A-Faster-Directory-Enumerator

The code was modified accordingly to prove that the implemented mechanism can be faster than .NET's built-in file enumeration technique. The original post mentions being able to enumerate files over the local network also, which has not been tested in this library. Feel free to test this out.

Give me the juice

  • Count the number of files and subdirectories recursively contained within a directory:
    • Slightly faster (~5%) and much less memory allocated (~99.5%)

Benchmarks

A minified version of an example run of the benchmarks in EnumeratedFileCountBenchmark.cs

Method Mean Ratio Allocated Alloc Ratio
GetFileCount 111.1 ms 0.95 99.25 KB 0.004
Directory_EnumerateFiles 116.6 ms 1.00 25741.13 KB 1.000

Evaluated directory structure:

  • root/
    • 1/
      • 1/
      • 2/ ... through 300/
      • 1.txt through 1000.txt
    • 2/ ... through 300/
      • same contents as root/1/
    • 1.txt through 1000.txt

Total: 301,000 Files, 300 Folders

Future considerations

This repo might contain more faster disk IO operations in the future covering arising needs. Feel free to open issues ensuring that enough research was done covering the requested operation.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 98 10/11/2024