finder-wpf / README.md
anshdadhich's picture
Update README.md
0d0a14b verified

FastSeek WPF

A Windows-only WPF port of the FastSeek instant file search tool.

Requirements

  • Windows 10/11
  • .NET 8 SDK or later
  • Administrator privileges (required for NTFS MFT and USN journal access)

Build

cd FastSeekWpf
dotnet publish -c Release -r win-x64 --self-contained false

Or just run from source:

cd FastSeekWpf
dotnet run

Must run as Administrator. Right-click β†’ Run as Administrator, or launch from an elevated PowerShell.

Usage

  • Alt+Space β€” toggle the search window
  • Esc β€” hide
  • Up/Down β€” navigate results
  • Enter β€” open selected file/folder
  • Ctrl+Enter β€” open containing folder
  • Type β€” search as you type (results update instantly)

Architecture

The app reads the NTFS Master File Table (MFT) directly via FSCTL_ENUM_USN_DATA / direct $MFT read, builds an in-memory index, and keeps it in sync via the USN Change Journal. Search is name-only with fuzzy matching and type-based ranking.

Performance Fixes Applied

  • Zero-CPU hotkey thread: Switched from PeekMessageW polling (Thread.Sleep(10)) to blocking GetMessageW with a manual reset event for clean shutdown. Idle CPU is now 0%.
  • Allocation-free search: SearchEngine uses cached lowercase string arrays (IndexStore.NameCache / NameLowerCache) instead of calling Encoding.UTF8.GetString in the hot loop. Uses Span<char> for matching, stack-allocated candidate arrays, and [ThreadStatic] reusable StringBuilder for path building.
  • Debounced search: TextChanged no longer blocks the UI thread. Searches run on a background thread with 25ms debounce and a CancellationTokenSource to cancel stale queries.
  • DWM rounded corners: Added DwmSetWindowAttribute with DWMWA_WINDOW_CORNER_PREFERENCE=DWMWCP_ROUND for native Windows 11 rounded window corners, plus DWMWA_USE_IMMERSIVE_DARK_MODE.
  • Arena-based inserts: IndexStore keeps List<byte> for arenas (O(1) append instead of Array.Resize on every insert). Live updates no longer copy the entire arena array.
  • Lock isolation: Search result building (path resolution, exclusion filtering, ranking) happens outside the lock(_indexLock) β€” only the candidate matching is inside. Deadlocks eliminated.

Known Issues / TODO

  • DWM rounded corners β€” fixed via DwmSetWindowAttribute P/Invoke
  • Zero-CPU hotkey thread β€” fixed via GetMessageW + manual reset event
  • Arena allocation churn β€” fixed via List<byte>.AddRange
  • Search blocking UI β€” fixed via debounced background search
  • Search results could use a virtualized ListView with container recycling for >10k visible items
  • No system tray icon β€” app runs hidden with hotkey toggle only
  • No settings UI for exclusions