Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2016-10-24 00:49 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (302 votes). Check out past polls.