4 ms·
OMM, looking at 700k files on a spinning disk, I'm getting an uncached run at 1m13s, and a cached run at 1.2 seconds. That's "time find . | wc -l" It's going
by wiredfool 13y ago
OMM, looking at 700k files on a spinning disk, I'm getting an uncached run at 1m13s, and a cached run at 1.2 seconds.
That's "time find . | wc -l"
It's going to be disk limited unless you're in cache.
Switching to "time find . -printf '1' | wc -c" lowers overhead to .7 seconds, so roughly 1us/file.
- jbarber 13y agoThere is a more important benefit to using the -prinf '1' approach - which is that it won't miscount the result if any of the filenames contain newlines.