Looking at the other posting to this I realize I should have included the
open and close in the test block. That makes the results...
Benchmark: timing 10000 iterations of Randals, variations...
   Randals: 16 wallclock secs ( 6.00 usr + 10.05 sys = 16.05 CPU) @ 622.98/s
(n=10000)
variations:  3 wallclock secs ( 1.22 usr +  1.94 sys =  3.17 CPU) @
3159.56/s (n=10000)

> 
> Try this...
> 
> use Benchmark;
> 
> opendir (DH, ".") or die;
> 
> timethese(50000, {
>       'Randals' => q{my @result = <*.jpg>},
>       'variations' => q{my @result = grep /\.jpg$/i, readdir DH}
> });
> 
> closedir(DH)
> 
> and change the 50000 to whatever you need to so that you get 
> a meaningfull
> time.  I got
> 
> Benchmark: timing 50000 iterations of Randals, variations...
>    Randals: 79 wallclock secs (28.94 usr + 49.99 sys = 78.93 
> CPU) @ 633.46/s
> (n=50000)
> variations:  0 wallclock secs ( 0.03 usr +  0.00 sys =  0.03 CPU) @
> 1666666.67/s (n=50000)
>             (warning: too few iterations for a reliable count) 
> 
> Peter C.
> 

Reply via email to