Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: The Great Computer Language Shootout

by Beechbone (Pilgrim)
on Sep 22, 2004 at 11:31 UTC ( #392897=note: print w/ replies, xml ) Need Help??


in reply to The Great Computer Language Shootout

(all discussion about benchmarking and comparing of languages silently ignored *g*)

...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 +";

Search, Ask, Know


Comment on Re: The Great Computer Language Shootout
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://392897]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2014-10-26 03:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (150 votes), past polls