3 ms·
It's not the pipe through wc, but statting the directory entries which slows you down. If your locatedb is current, you can use locate for this: $ locate
by dredmorbius 13y ago
It's not the pipe through wc, but statting the directory entries which slows you down.
If your locatedb is current, you can use locate for this:
$ locate $PWD | wc -l
That runs in just a hair under a second (0.908s real) for the first instance. 'find' takes a few seconds on first pass (it's got to read from disk), but is surprising fast (0.227s real) on subsequent runs.
So I guess it depends on whether you're doing it just once or multiple times.