[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Modification date



At 13.42 -0400 1998.08.30, Brian "L." Matthews wrote:
>So using -M to get the mod date is slower than stat, and less precise.

Slower?

#!perl -w
use Benchmark;
timethese(100000, {
  '-M'   => 'my $x = ($^T - (-M "MacPerl") * 86400)',
  'stat' => 'my $x = ((stat("MacPerl"))[9])',
});
__END__

Benchmark: timing 10000 iterations of -M, stat...
        -M:  3 secs ( 2.63 usr  0.00 sys =  2.63 cpu)
      stat:  3 secs ( 2.88 usr  0.00 sys =  2.88 cpu)
Benchmark: timing 10000 iterations of -M, stat...
        -M:  3 secs ( 2.55 usr  0.00 sys =  2.55 cpu)
      stat:  2 secs ( 2.80 usr  0.00 sys =  2.80 cpu)
Benchmark: timing 10000 iterations of -M, stat...
        -M:  2 secs ( 2.53 usr  0.00 sys =  2.53 cpu)
      stat:  3 secs ( 2.70 usr  0.00 sys =  2.70 cpu)
Benchmark: timing 100000 iterations of -M, stat...
        -M: 31 secs (29.57 usr  0.00 sys = 29.57 cpu)
      stat: 27 secs (28.03 usr  0.00 sys = 28.03 cpu)
Benchmark: timing 100000 iterations of -M, stat...
        -M: 26 secs (25.93 usr  0.00 sys = 25.93 cpu)
      stat: 28 secs (28.95 usr  0.00 sys = 28.95 cpu)

They seem equivalent in speed.

Less precise?  How so?  Seems to me they are equivalent.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch