snowcrash has asked for the wisdom of the Perl Monks concerning the following question:
version 1 is about 100 times faster on my machine... i'm running 5.005_03 built for i386-linux.my @data = ( 0 .. 50000); my %hash = () ; ### version 1 map { $hash{$_}++ } @data; ### version 2 %hash = map { $_ => 1 } @data; ### version 3 ### as fast as version 1 %hash = map { $_ => } @data
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: map efficiency
by tye (Sage) on Jan 31, 2001 at 00:17 UTC | |
|
Re: map efficiency
by japhy (Canon) on Jan 31, 2001 at 00:17 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |