in reply to Re: (Efficiently) comparing arrays
in thread comparing arrays
Needless to say they were nearly identical for a difference at the start of the array.sub maptest { my ($low, $high) = @_; my $i=0; return 0 if @$low != @$high; map{return 0 if $_ ne $low->[$i++]}@$high; return 1; } __END__ with my @first = ((1..200), qw(a b c d e f)) ; my @second= ((1..200), qw(b a c d e f)) ; Benchmark: timing 20000 iterations of faq, map... faq: 8 wallclock secs ( 8.44 usr + 0.00 sys = 8.44 CPU) map: 10 wallclock secs ( 9.64 usr + 0.00 sys = 9.64 CPU)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(MeowChow) Re3: (Efficiently) comparing arrays
by MeowChow (Vicar) on Apr 04, 2002 at 10:19 UTC | |
by demerphq (Chancellor) on Apr 04, 2002 at 14:09 UTC |