...but some of the Perl snippets are really bad. I took the time to speed up the 'hash2' by about 15%:
use strict; my $n = $ARGV[0] || 1; my %hash1 = (); for (my $i = 0; $i <= 9999; $i++) { $hash1{"foo_$i"} = $i; } my %hash2 = (); for (my $i = 1; $i <= $n; $i++) { foreach (keys %hash1) { $hash2{$_} += $hash1{$_}; } } print "$hash1{foo_1} $hash1{foo_9999} $hash2{foo_1} $hash2{foo_9999}\n +";
In reply to Re: The Great Computer Language Shootout
by Beechbone
in thread The Great Computer Language Shootout
by yperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |