On Thu, Jan 10, 2008 at 03:45:46PM -0600, John J. Trammell wrote:
> On Jan 10, 2008 2:16 PM, Mike Miller <mbmiller at taxa.epi.umn.edu> wrote:
> > I wonder how the various methods compare in speed.  With a lot of files
> > they must all be pretty slow, so speed is important.
> 
> A worthy question!
> 
> % time perl -MFile::Find::Rule -MList::Util=max -le 'print scalar
> localtime(max map { (stat($_))[9] } find->in("."))'
> Thu Jan 10 15:20:58 2008
> real    0m1.122s
> user    0m0.918s
> sys     0m0.203s
> 
> So that's about 50 usec per file.  Comparing with find + awk:
> 
> time find . -type f -printf "%T@\n" | awk '{ if ($1 > the_max) { the_max =
> $1; } } END { print the_max }'
> 1200000058
> 
> real    0m0.168s
> user    0m0.071s
> sys     0m0.116s
> % perl -le 'print 1000000 * 0.168 / 22531'
> 7.45639341351915
> 
> So something like 7usec per file.

Thank you, thank you, thank you.

I would like to thank the man page...

florin

-- 
Bruce Schneier expects the Spanish Inquisition.
      http://geekz.co.uk/schneierfacts/fact/163
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20080110/6e74afb7/attachment.pgp