Open afontenot opened 3 years ago
Incidentally, I wonder if you have some idea why walkdir
might be so much faster than nftw
on my system. I discovered this while writing my own code using them, but I found that it's easily replicable with your example programs:
$ ./target/release/walkdir-list -tcq /usr
739824
duration: 845.646209ms
In nftw.c
, I removed the printf
call and built it with gcc -O3
.
$ time ./nftw /usr
./nftw /usr 0.33s user 1.52s system 99% cpu 1.869 total
Walkdir is faster than find
for me as well.
Edit: using strace
, it looks like the difference is probably that nftw
calls stat
on every file in the tree, whereas walkdir
does not (presumably only calling stat
when needed). If that's what's happening here, may be worth mentioning that in the README?
In https://github.com/BurntSushi/walkdir/commit/526d70b165d902b2749fffd6f50d13c1c5ed87e1 the example was replaced by the walkdir-list crate, but the README still references this old example: