in reply to Re^2: How to connect more arrays to a new array (hash, without temporaries)
in thread Find unique elements from multiple arrays
Grin:)
@a=1.10; @b=1..100; @c=1..1000; @d=1..10000; use Benchmark 'cmpthese'; $ari = '@A = keys %{{ map +($_ => undef), @a, @b, @c, @d }};'; $buk = '@B = do{local %h; ++@h{@a,@b,@c,@d}; keys %h};'; cmpthese( -1, { ari=>$ari, buk=>$buk }); (warning: too few iterations for a reliable count) (warning: too few iterations for a reliable count) Rate ari buk ari 1.69/s -- -28% buk 2.36/s 39% -- cmpthese( -3, { ari=>$ari, buk=>$buk }); Rate ari buk ari 1.81/s -- -22% buk 2.32/s 28% -- cmpthese( -3, { ari=>$ari, buk=>$buk }); Rate ari buk ari 1.82/s -- -24% buk 2.40/s 32% -- print 'Same' if "@A" eq "@B" Same
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re^2: How to connect more arrays to a new array
by Anonymous Monk on Apr 28, 2003 at 12:36 UTC | |
by Abigail-II (Bishop) on Apr 28, 2003 at 12:50 UTC | |
by BrowserUk (Patriarch) on Apr 28, 2003 at 13:17 UTC | |
by Abigail-II (Bishop) on Apr 28, 2003 at 13:42 UTC | |
by BrowserUk (Patriarch) on Apr 28, 2003 at 13:49 UTC | |
|