use Benchmark 'cmpthese'; use strict; my @x = map join(',', split(//, rand(10000))), 0..80000; my %y; cmpthese(-2, {'@y{@x}' => sub { undef %y; @y{@x} = undef }, '%y = map' => sub { undef %y; %y = map(($_ => undef), @x) } } ); print 0+%y,$/; #### s/iter %y = map @y{@x} %y = map 2.45 -- -49% @y{@x} 1.25 97% -- #### # ...snip my ($n,$i,@n,@temp,%arrangements); # get size and create all permutations (comma separated) $n = 8; @n = (1..$n); $i = 0; $temp[&_fact($n)-1] = 1; # _fact := n! $|++; permute { $temp[$i++] = join(',',@n) } @n; print STDERR scalar(localtime),$/; @arrangements{@temp} = undef; print STDERR scalar(localtime),$/; #### computing 8-arrangements... Mon Sep 30 15:30:31 2002 Mon Sep 30 15:33:35 2002