chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Good way to code the equivalent to this?


From: Matt Welland
Subject: [Chicken-users] Good way to code the equivalent to this?
Date: Sat, 23 Aug 2008 09:19:19 -0700

My attempts all use gigs of memory and run 10x as long.

#!/usr/bin/perl -w
print "Filling the array with 250000 entries.\n";
foreach $n (0 .. 250000) {
  $x = int(rand(500000));
  $y = int(rand(500000));
  $a{$x}{$y}=1;
}

print "Reading from the arrary 10000 times\n";
$hits=0;
foreach $n (0 .. 10000) {
  $x = int(rand(500000));
  $y = int(rand(500000));
  if (defined $a{$x}{$y}) {
    $hits++;
  }
}

print "Done\n";


-- 
Visit www.kiatoa.com, a user-run, self governing
web site.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]