Re:Unix Commands I Wish I’d Discovered Years Earlier
by 0x09 on Tuesday September 10, 2013 @06:44PM
(#6364087)
du just uses the fts API, so if you want something directly equivalent (omitting options and error handling) it was only barely too long to post: http://pastie.org/8315296
Compared to the equivalent find, code #1 is much faster in this completely scientific best of several runs:
$ time (find OSS/llvm -type f -or -type l | wc -l)
real 0m4.681s
$ time du -d0 OSS/llvm
real 0m4.863s
$ time ./fts OSS/llvm
real 0m0.559s
Ostensibly because of the lack of stat calls. On the other hand the second paste and find with no arguments are equivalent.
Compared to the equivalent find, code #1 is much faster in this completely scientific best of several runs:
Ostensibly because of the lack of stat calls. On the other hand the second paste and find with no arguments are equivalent.edit: screwed up benchmarks