Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Fast data structure..!!!

by FunkyMonk (Canon)
on Apr 15, 2008 at 15:31 UTC ( #680541=note: print w/ replies, xml ) Need Help??


in reply to Fast data structure..!!!

I see only four options for you:
  1. Buy a faster computer
  2. use an array, not a hash (if your data really is numerical & sequenced)
  3. Code it in C
  4. Live with it
Here's some timings on my computer (Linux, Perl 5.8.8, AMD Dual core 4800)
use Time::HiRes qw/time/; my $start = time; my %save; for(0 .. 2000000) { $save{$_}{$_+1}=$_+2; } print "hash: ", time - $start, "\n"; $start = time; my @save; for(0 .. 2000000) { $save[$_]{$_+1}=$_+2; } print "array: ", time - $start, "\n"; #Ouput: #hash: 4.92373299598694 #array: 3.34077191352844


Comment on Re: Fast data structure..!!!
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (17)
As of 2014-07-28 19:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (206 votes), past polls