Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://680541]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2017-06-23 11:17 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (543 votes). Check out past polls.