perf(mediascanner): use fastwalk for parallel directory walking#550
Merged
wizzomafizzo merged 3 commits intomainfrom Mar 6, 2026
Merged
perf(mediascanner): use fastwalk for parallel directory walking#550wizzomafizzo merged 3 commits intomainfrom
wizzomafizzo merged 3 commits intomainfrom
Conversation
Replace filepath.WalkDir with charlievieth/fastwalk for parallel directory traversal in GetFiles(). fastwalk walks subdirectories concurrently, skips per-directory sorting, and uses raw syscalls to reduce overhead. Also enables built-in symlink following with cycle detection, replacing the manual visited map and recursive walk logic. Remove dirCache (dircache.go) which cached root directory listings during path discovery. The kernel page cache already makes repeat ReadDir calls on the same directory essentially free, making the userspace cache redundant. GetSystemPaths now uses FindPath uniformly for all folder lookups, which is simpler and still timeout-protected via fsutil.go wrappers for stale mount handling.
Raise dial, TLS handshake, response header, and overall client timeouts to more reasonable values for real-world network conditions.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Add tests for relative folder resolution in GetSystemPaths, nonexistent folder skipping, and ZipsAsDirs handling in the fastwalk-based GetFiles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
filepath.WalkDirwithcharlievieth/fastwalkfor parallel directory traversal inGetFiles(). fastwalk walks subdirectories concurrently, skips per-directory sorting, and uses raw syscalls to reduce overhead. Built-in symlink following with cycle detection replaces the manualvisitedmap and recursive walk logic, cuttingGetFiles()from ~180 lines to ~50.dirCache(dircache.go) which cached root directory listings during path discovery. The kernel page cache already makes repeatReadDircalls essentially free, so the userspace cache was redundant.GetSystemPathsnow usesFindPathuniformly for all folder lookups — simpler and still timeout-protected viafsutil.gofor stale NAS/mount handling.Benchmarked on MiSTer (single available core): ~5% improvement on walk phase. Multi-core platforms should see larger gains from the parallel workers.