Zum Inhalt springen

Why I built rq: A faster way to search files on Windows

If you’ve ever tried searching for files on Windows, you know the pain.
Windows Explorer search is slow, and PowerShell’s Get-ChildItem crawls on large directories. Tools like Everything are fast, but they’re GUI-first—not ideal when you need something scriptable and automation-friendly.

I wanted a lightning-fast, command-line tool for Windows that just works. So I built rq: an open-source file search utility written in modern C17, optimized for speed and simplicity.

⚡ Why rq?

  • Speed: Typically 3–7x faster than common alternatives like Get-ChildItem
  • Parallel directory traversal: Built on the Windows Thread Pool API
  • Flexible search: Supports glob, regex, and hidden files
  • Powerful filters: Size, extension, date, file type
  • Automation-friendly: Streams results as plain text or JSON

🔍 Example Usage

# Find all C/C++ source files
rq C:Dev "*.c" --glob --ext c,h

# Search for large images
rq D:Photos beach --ext jpg,png --size +500K

# Export recent documents as JSON
rq C:UsersmeDocuments report --ext pdf,docx --after 2025-01-01 --json

🛠️ Under the Hood

Building rq wasn’t just about speed—it was about handling the quirks of Windows:

  • Long paths & Unicode: rq uses \? paths and UTF-8 internally
  • Thread pools over raw threads: Better scalability and resource control
  • Minimal syscalls in hot paths: Avoid unnecessary overhead for performance
  • Custom directory traversal logic: Fully parallel with dynamic work distribution

✅ Lessons Learned

  • C17 is still fantastic for high-performance, low-overhead tools
  • Windows APIs are powerful but tricky—path handling and Unicode are a minefield
  • Thread pools > raw threads for stability and performance
  • Avoid syscalls in tight loops for real speed gains

📦 Try It Out

rq is open source (MIT) on GitHub:
👉 https://github.com/seeyebe/rq

If you use Windows and need a fast, scriptable file search, give it a try!
Feedback, feature requests, and contributions are more than welcome.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert