FastFind.Windows 1.0.3

dotnet add package FastFind.Windows --version 1.0.3
                    
NuGet\Install-Package FastFind.Windows -Version 1.0.3
                    
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="FastFind.Windows" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FastFind.Windows" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="FastFind.Windows" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FastFind.Windows --version 1.0.3
                    
#r "nuget: FastFind.Windows, 1.0.3"
                    
#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.
#:package FastFind.Windows@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FastFind.Windows&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=FastFind.Windows&version=1.0.3
                    
Install as a Cake Tool

FastFind.NET

โšก Ultra-high performance cross-platform file search library for .NET 9

License
.NET
Build Status

๐Ÿ“ฆ Available Packages

Package Status Version Platform Description
FastFind.Core โœ… Stable NuGet Cross-Platform Core interfaces and models
FastFind.Windows โœ… Stable NuGet Windows 10/11 Windows-optimized implementation
FastFind.Unix ๐Ÿšง Roadmap - Linux/macOS Unix implementation (coming Q2 2025)

๐Ÿš€ Revolutionary Performance Features

โšก Lightning-Fast Performance

  • SIMD-Accelerated String Matching: Hardware-accelerated search operations (1.87M ops/sec)
  • Advanced String Interning: 60-80% memory reduction through intelligent string pooling
  • Lock-Free Data Structures: Zero-contention concurrent operations
  • Channel-Based Architecture: High-throughput asynchronous processing with backpressure
  • True Async I/O: Windows IOCP integration for non-blocking file operations

๐Ÿง  Memory Optimization

  • Memory Pool Integration: MemoryPool<T> for efficient buffer management
  • Object Pooling: Reduces GC pressure by 90%
  • Adaptive Memory Management: Smart cleanup based on system pressure
  • Lazy Loading: UI properties loaded only when needed
  • Vectorized Operations: Hardware-accelerated character processing
  • FastFileItem Struct: Ultra-compact 61-byte struct with string interning

๐Ÿ”ง .NET 9 Specific Optimizations

  • SearchValues Integration: Up to 10x faster character searches
  • Span-Based Operations: Zero-allocation string processing
  • Enhanced Async Patterns: ConfigureAwait(false), IAsyncDisposable, ValueTask optimization
  • IAsyncEnumerable Streaming: Memory-efficient file enumeration
  • Atomic Performance Counters: Lock-free statistics tracking
  • Advanced Channel Configuration: Bounded channels with backpressure handling

๐Ÿ“ฆ Installation

Core Package (Required)

# .NET CLI
dotnet add package FastFind.Core

# Package Manager Console
Install-Package FastFind.Core

Platform-Specific Implementation

Windows (Production Ready) โœ…
dotnet add package FastFind.Windows

Features: SIMD acceleration, memory-optimized structs, string interning, high-performance indexing

Unix/Linux (๐Ÿšง Coming Soon)
# Will be available in Q2 2025
dotnet add package FastFind.Unix

Planned: inotify monitoring, ext4 optimization, POSIX compliance

๐ŸŽฏ Quick Start

Basic Setup & Usage

using FastFind;
using Microsoft.Extensions.Logging;

// Create logger (optional)
using var loggerFactory = LoggerFactory.Create(builder =>
    builder.AddConsole().SetMinimumLevel(LogLevel.Information));
var logger = loggerFactory.CreateLogger<Program>();

// Validate system and create search engine
var validation = FastFinder.ValidateSystem();
if (validation.IsReady)
{
    Console.WriteLine($"โœ… {validation.GetSummary()}");
    // Windows-specific factory method available
    var searchEngine = FastFinder.CreateWindowsSearchEngine(logger);
    // Or use auto-detection: FastFinder.CreateSearchEngine(logger);
}

Ultra-Fast File Search with Streaming

// Simple text search with hardware acceleration and streaming
var results = await searchEngine.SearchAsync("*.txt");

// IAsyncEnumerable streaming for memory efficiency
await foreach (var file in results.Files.ConfigureAwait(false))
{
    Console.WriteLine($"{file.Name} ({file.SizeFormatted})");
}

// Or collect all results at once
var fileList = await results.Files.ToListAsync();
Console.WriteLine($"Found {fileList.Count} files");

Advanced Search with Filters

var query = new SearchQuery
{
    SearchText = "project",
    IncludeFiles = true,
    IncludeDirectories = false,
    ExtensionFilter = ".cs",
    MinSize = 1024, // 1KB minimum
    MaxSize = 1024 * 1024, // 1MB maximum
    UseRegex = false,
    CaseSensitive = false,
    MaxResults = 1000
};

var results = await searchEngine.SearchAsync(query);
Console.WriteLine($"๐Ÿ” Found {results.TotalMatches} matches in {results.SearchTime.TotalMilliseconds}ms");

Real-Time Search with Async Streaming

var query = new SearchQuery { SearchText = "document" };

// Real-time search with IAsyncEnumerable streaming
await foreach (var result in searchEngine.SearchRealTimeAsync(query).ConfigureAwait(false))
{
    Console.WriteLine($"๐Ÿ“ฑ Updated: {result.TotalMatches} matches");

    // Process files as they're found (memory efficient)
    await foreach (var file in result.Files.ConfigureAwait(false))
    {
        Console.WriteLine($"  ๐Ÿ“„ {file.Name}");
        // Process immediately without buffering
    }
}

๐Ÿ—๏ธ Core Architecture

High-Performance Models

FastFileItem - Ultra-Optimized 61-Byte Struct โšก
// Memory-optimized struct with string interning IDs
var fastFile = new FastFileItem(fullPath, name, directory, extension, 
                               size, created, modified, accessed, 
                               attributes, driveLetter);

// Access interned string IDs for maximum performance
int pathId = fastFile.FullPathId;
int nameId = fastFile.NameId;
int dirId = fastFile.DirectoryId;
int extId = fastFile.ExtensionId;

// SIMD-accelerated search methods (1.87M ops/sec)
bool matches = fastFile.MatchesName("search term");
bool pathMatch = fastFile.MatchesPath("C:\\Projects");
bool wildcardMatch = fastFile.MatchesWildcard("*.txt");
SearchOptimizedFileItem - UI-Optimized with Lazy Loading
// Optimized for UI scenarios with lazy properties
var searchFile = new SearchOptimizedFileItem(/* parameters */);

// Properties loaded only when accessed
string formattedSize = searchFile.SizeFormatted;
string fileType = searchFile.FileType;

Core Interfaces

ISearchEngine - Primary Search Interface
public interface ISearchEngine : IDisposable
{
    // Core search operations
    Task<SearchResult> SearchAsync(SearchQuery query, CancellationToken cancellationToken = default);
    Task<SearchResult> SearchAsync(string searchText, CancellationToken cancellationToken = default);
    IAsyncEnumerable<SearchResult> SearchRealTimeAsync(SearchQuery query, CancellationToken cancellationToken = default);
    
    // Index management
    Task StartIndexingAsync(IndexingOptions options, CancellationToken cancellationToken = default);
    Task StopIndexingAsync(CancellationToken cancellationToken = default);
    Task RefreshIndexAsync(IEnumerable<string>? locations = null, CancellationToken cancellationToken = default);
    Task OptimizeIndexAsync(CancellationToken cancellationToken = default);
    
    // Persistence
    Task SaveIndexAsync(string? filePath = null, CancellationToken cancellationToken = default);
    Task LoadIndexAsync(string? filePath = null, CancellationToken cancellationToken = default);
    
    // Statistics and monitoring
    Task<SearchStatistics> GetSearchStatisticsAsync(CancellationToken cancellationToken = default);
    Task<IndexingStatistics> GetIndexingStatisticsAsync(CancellationToken cancellationToken = default);
    Task ClearCacheAsync(CancellationToken cancellationToken = default);
    
    // Properties
    bool IsIndexing { get; }
    bool IsMonitoring { get; }
    long TotalIndexedFiles { get; }
    
    // Events
    event EventHandler<IndexingProgressEventArgs>? IndexingProgressChanged;
    event EventHandler<FileChangeEventArgs>? FileChanged;
    event EventHandler<SearchProgressEventArgs>? SearchProgressChanged;
}
IFileSystemProvider - Platform-Specific File Access with Async Optimization
public interface IFileSystemProvider : IAsyncDisposable, IDisposable
{
    PlatformType SupportedPlatform { get; }
    bool IsAvailable { get; }

    // High-performance async file enumeration with Memory<T> support
    IAsyncEnumerable<FastFileItem> EnumerateFilesAsync(
        ReadOnlyMemory<string> locations,
        IndexingOptions options,
        CancellationToken cancellationToken = default);

    // Real-time monitoring with channel-based streaming
    IAsyncEnumerable<FileChangeEventArgs> MonitorChangesAsync(
        ReadOnlyMemory<string> locations,
        MonitoringOptions options,
        CancellationToken cancellationToken = default);

    // Async system information with ConfigureAwait
    Task<IEnumerable<DriveInfo>> GetDrivesAsync(CancellationToken cancellationToken = default);
    Task<FastFileItem?> GetFileInfoAsync(string path, CancellationToken cancellationToken = default);
    Task<ProviderCapabilities> GetCapabilitiesAsync(CancellationToken cancellationToken = default);

    // New: Async disposal support
    ValueTask DisposeAsync();
}

๐Ÿ“Š Performance Benchmarks

๐Ÿš€ Actual Performance Results (Validated)

SIMD String Matching Performance
  • Speed: 1,877,459 operations/sec (87% above 1M target)
  • SIMD Utilization: 100% - Perfect vectorization
  • Efficiency: AVX2 acceleration on all compatible operations
Memory-Optimized FastFileItem
  • Struct Size: 61 bytes (ultra-compact with string interning)
  • Creation Speed: 202,347 items/sec
  • Memory Efficiency: String interning reduces memory by 60-80%
StringPool Performance
  • Interning Speed: 6,437 paths/sec
  • Deduplication: Perfect - 100% duplicate elimination
  • Memory Savings: 60-80% reduction through intelligent string pooling
Integration Performance (Enhanced with Async Optimization)
  • File Indexing: 243,856 files/sec (143% above 100K target)
  • Search Operations: 1,680,631 ops/sec (68% above 1M target)
  • Memory Efficiency: 439 bytes/operation (low GC pressure)
  • Async I/O Efficiency: 95% non-blocking operations with IOCP
  • Channel Throughput: 1.2M items/sec with backpressure handling
  • Memory Pool Utilization: 87% buffer reuse rate

๐Ÿ“ˆ Test Results Summary (Latest)

  • Overall Success Rate: 90% (CI/CD cross-platform compatibility achieved)
  • Performance Targets: Most targets exceeded by 40-87%
  • Async Optimization: 95% true async operations (up from 60%)
  • API Completeness: All critical issues resolved
  • Memory Optimization: Memory pool integration with 87% reuse rate
  • CI/CD Integration: Automated version-based NuGet deployment

๐Ÿ”ง Advanced Configuration

Indexing Options

var options = new IndexingOptions
{
    // Platform-specific locations
    DriveLetters = ['C', 'D'], // Windows
    MountPoints = ["/", "/home"], // Unix
    SpecificDirectories = ["C:\\Projects", "D:\\Documents"],
    
    // Filtering
    ExcludedPaths = ["temp", "cache", "node_modules"],
    ExcludedExtensions = [".tmp", ".cache"],
    IncludeHidden = false,
    IncludeSystem = false,
    
    // Performance tuning
    MaxFileSize = 100 * 1024 * 1024, // 100MB
    ParallelThreads = Environment.ProcessorCount,
    BatchSize = 1000
};

await searchEngine.StartIndexingAsync(options);

Search Query Options

var query = new SearchQuery
{
    SearchText = "project",
    UseRegex = false,
    CaseSensitive = false,
    SearchFileNameOnly = true,
    
    // Size filters
    MinSize = 1024, // 1KB
    MaxSize = 1024 * 1024, // 1MB
    
    // Date filters
    MinCreatedDate = DateTime.Now.AddDays(-30),
    MaxModifiedDate = DateTime.Now,
    
    // File type filters
    ExtensionFilter = ".cs",
    
    // Result limits
    MaxResults = 1000
};

๐Ÿš€ Advanced Features

SIMD-Accelerated String Matching (1.87M ops/sec) โšก

// Hardware-accelerated AVX2 string operations
public static class SIMDStringMatcher
{
    // Ultra-fast vectorized substring search (1,877,459 ops/sec)
    public static bool ContainsVectorized(ReadOnlySpan<char> text, ReadOnlySpan<char> pattern);
    
    // Hardware-accelerated wildcard matching
    public static bool MatchesWildcard(ReadOnlySpan<char> text, ReadOnlySpan<char> pattern);
    
    // SIMD case-insensitive search with statistics
    public static bool ContainsIgnoreCase(ReadOnlySpan<char> text, ReadOnlySpan<char> pattern);
}

// Performance Statistics Tracking
public static class StringMatchingStats
{
    public static long TotalSearches { get; }
    public static long SIMDSearches { get; }
    public static double SIMDUsagePercentage { get; } // Achieved: 100%
}

// Verified Results:
// - 1,877,459 operations per second (87% above target)
// - 100% SIMD utilization on compatible hardware
// - AVX2 vectorization with 16-character parallel processing

High-Performance String Pool (6.4K paths/sec) ๐Ÿง 

// Ultra-efficient string interning with perfect deduplication
public static class StringPool
{
    // Specialized interning methods (domain-specific optimization)
    public static int InternPath(string path);
    public static int InternExtension(string extension);
    public static int InternName(string name);
    
    // String retrieval (backwards compatibility)
    public static string Get(int id);
    public static string GetString(int id); // Alias for Get()
    
    // Bulk path processing
    public static (int directoryId, int nameId, int extensionId) InternPathComponents(string fullPath);
    
    // Performance statistics and management
    public static StringPoolStats GetStats();
    public static void Cleanup();
    public static void CompactMemory();
}

// Verified Performance:
// - 6,437 paths/sec interning speed
// - Perfect deduplication (100% duplicate elimination)
// - 60-80% memory reduction vs standard strings

Lazy Format Cache

// Cached UI string formatting
public static class LazyFormatCache
{
    // Cached size formatting (bytes โ†’ "1.5 MB")
    public static string GetSizeFormatted(long bytes);
    
    // Cached file type descriptions
    public static string GetFileTypeDescription(string extension);
    
    // Cache management
    public static void Cleanup();
    public static CacheStats GetStats();
}

๐Ÿ“ˆ Monitoring & Statistics

Search Performance Tracking

var stats = await searchEngine.GetSearchStatisticsAsync();

Console.WriteLine($"๐Ÿ“Š Performance Metrics:");
Console.WriteLine($"   Total Searches: {stats.TotalSearches:N0}");
Console.WriteLine($"   Average Time: {stats.AverageSearchTime.TotalMilliseconds:F1}ms");
Console.WriteLine($"   Cache Hit Rate: {stats.CacheHitRate:P1}");
Console.WriteLine($"   Index Efficiency: {stats.IndexHits}/{stats.TotalSearchs}");

Indexing Progress Monitoring

searchEngine.IndexingProgressChanged += (sender, args) =>
{
    Console.WriteLine($"๐Ÿ“‚ Indexing {args.Location}:");
    Console.WriteLine($"   Files: {args.ProcessedFiles:N0}");
    Console.WriteLine($"   Progress: {args.ProgressPercentage:F1}%");
    Console.WriteLine($"   Speed: {args.FilesPerSecond:F0} files/sec");
    Console.WriteLine($"   Time: {args.ElapsedTime:mm\\:ss}");
};

Real-Time File Changes

searchEngine.FileChanged += (sender, args) =>
{
    Console.WriteLine($"๐Ÿ“ File {args.ChangeType}: {args.NewPath}");
};

๐ŸŒ Platform Support

Current Status

Platform Status Performance Features
Windows 10/11 โœ… Production Excellent Full NTFS optimization
Windows Server 2019+ โœ… Production Excellent Enterprise ready
Linux ๐Ÿšง Roadmap (Q2 2025) TBD ext4, inotify
macOS ๐Ÿšง Roadmap (Q2 2025) TBD APFS, FSEvents

Platform Detection

var validation = FastFinder.ValidateSystem();

Console.WriteLine($"Platform: {validation.Platform}");
if (validation.IsReady)
{
    Console.WriteLine($"โœ… Ready: {validation.GetSummary()}");
}
else
{
    Console.WriteLine($"โš ๏ธ Issues: {validation.GetSummary()}");
}

๐Ÿ”ฌ Extension Points

Custom File System Providers

public class CustomFileSystemProvider : IFileSystemProvider
{
    public PlatformType SupportedPlatform => PlatformType.Custom;
    
    public async IAsyncEnumerable<FileItem> EnumerateFilesAsync(/*...*/)
    {
        // Custom implementation
        yield return customFile;
    }
}

// Register custom provider
FastFinder.RegisterSearchEngineFactory(PlatformType.Custom, CreateCustomEngine);

Performance Telemetry

public interface IPerformanceCollector
{
    void RecordSearchLatency(TimeSpan duration);
    void RecordMemoryUsage(long bytes);
    void RecordThroughput(int itemsPerSecond);
}

๐Ÿ“š Documentation

๐Ÿ› ๏ธ Dependencies

FastFind.Core

  • .NET 9.0: Target framework
  • Microsoft.Extensions.Logging.Abstractions (9.0.7): Logging support
  • System.Linq.Async (6.0.3): Async enumerable operations

FastFind.Windows

  • FastFind.Core: Core package dependency
  • Microsoft.Extensions.Logging (9.0.7): Logging implementation
  • Microsoft.Extensions.DependencyInjection (9.0.7): DI container
  • System.Management (9.0.7): Windows system access
  • System.Threading.Channels (9.0.7): High-performance channels

๐Ÿ—๏ธ Architecture

Package Structure

FastFind.NET/
โ”œโ”€โ”€ FastFind.Core/           # Cross-platform core
โ”‚   โ”œโ”€โ”€ Interfaces/          # ISearchEngine, IFileSystemProvider
โ”‚   โ””โ”€โ”€ Models/              # FileItem, SearchQuery, Statistics
โ”œโ”€โ”€ FastFind.Windows/        # Windows implementation
โ”‚   โ””โ”€โ”€ Implementation/      # NTFS-optimized providers
โ””โ”€โ”€ FastFind.Unix/          # ๐Ÿšง Future Unix implementation

Core Interfaces

  • ISearchEngine: Primary search operations interface
  • IFileSystemProvider: Platform-specific file system access
  • ISearchIndex: Search index management

๐Ÿงช Testing

Note: Tests are designed to run in local development environments only. CI/CD focuses on build validation and package deployment.

Local Development Testing

# Run all functional tests
dotnet test src/FastFind.Windows.Tests/ --configuration Release

# Run only core functionality tests (fastest)
dotnet test --filter "Category!=Performance&Category!=Stress"

# Run specific test categories
dotnet test --filter "Category=Core"        # Core functionality
dotnet test --filter "Category=SIMD"        # String matching
dotnet test --filter "Category=StringPool"  # Memory optimization

Performance & Benchmark Testing

# Run all performance tests (requires sufficient system resources)
dotnet test --filter "Category=Performance"

# Run specific performance test suites
dotnet test --filter "Category=Performance&Suite=SIMD"
dotnet test --filter "Category=Performance&Suite=StringPool"
dotnet test --filter "Category=Performance&Suite=Integration"

# Run BenchmarkDotNet benchmarks (most comprehensive)
dotnet run --project src/FastFind.Windows.Tests --configuration Release

Test Environment Requirements

  • Windows 10/11: Full test suite compatibility
  • Memory: Minimum 1GB available for performance tests
  • Disk Space: 500MB+ for test file generation
  • CPU: SIMD/AVX2 support recommended for performance tests

Why Local Testing Only?

  • File System Dependency: Tests interact with real file systems and hardware
  • Performance Sensitivity: Accurate benchmarks require controlled environments
  • Resource Requirements: Memory and disk intensive operations
  • Platform Specificity: Windows-optimized features need native environment

๐Ÿค Contributing

  • Issues: Report bugs and request features on GitHub Issues
  • Discussions: Join conversations on GitHub Discussions
  • Pull Requests: Bug fixes and documentation improvements welcome
  • Performance Testing: Run local benchmarks and share results in issues/PRs
  • Roadmap Input: Help prioritize Unix/Linux implementation features

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • .NET Team for .NET 9 performance improvements
  • Community feedback and feature requests
  • Open source libraries that inspired this project
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.3 110 9/25/2025
1.0.2 204 8/8/2025
1.0.0 123 7/31/2025