File size: 2,811 Bytes
0d0a14b e306d7e fffc3ee e306d7e fffc3ee e306d7e fffc3ee e306d7e fffc3ee e306d7e fffc3ee e306d7e fffc3ee e306d7e fffc3ee e306d7e fffc3ee e306d7e 3301306 e306d7e 3301306 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# 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
```powershell
cd FastSeekWpf
dotnet publish -c Release -r win-x64 --self-contained false
```
Or just run from source:
```powershell
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
- [x] DWM rounded corners β fixed via `DwmSetWindowAttribute` P/Invoke
- [x] Zero-CPU hotkey thread β fixed via `GetMessageW` + manual reset event
- [x] Arena allocation churn β fixed via `List<byte>.AddRange`
- [x] 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
|