For what it's worth, at least for systems where one can assume post-POSIX.2008 APIs like `openat` and `fstatat` (really any vaguely recent Linux/BSD), it is possible to roll your own recursion that, in my timings, is about 4x faster hot cache than `walkDirRec` (note no trailing 't'). What boost one gets depends on whether you need that `Stat` metadata (e.g. file times, sizes, owner, perms, etc.) or just path names. Those ideas are in the current `cligen/dents.nim:forPath` template for Unix users. (It could actually be sped up a couple ways still, but not very portably.)
Of course, depending on the scenario/hotness of caches, the boost may not matter much. Costs from the recursion may be tiny compared to IO/other work. Or it could dominate. Personally, I do a lot of work out of a `tmpfs /dev/shm` bind mount to `/tmp` which never has any IO. Mostly I was just giving yet another syntax for packaging up recursions..one that lets the guts hang out more and the calling code has to/ ** _gets to_** be aware of that while maybe having delegated the low-level system stuff to the template author. Nim is pretty great like that. BTW, I did re-arrange the order of the 4 event clauses to `always, preRec, postRec, recFail` and provide a `recFailDefault` template to make things read more nicely. So, my above code example won't quite work as written anymore. Best to start from one of the 4 worked out examples after the template in `dents.nim` if you want to use it.