From: Michael Tan Date: 2005-06-26T12:11:31+09:00 Subject: Re: I saw the beauty of Ruby Re: 1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds --0-379824569-1119755488=:32238 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit I always got the almost same results on my laptop: (Pentium M 1.5G, 1G ram). I closed all other programs, Excel, Eclipse, browsers, ...before I ran it. C:\temp>ruby test.rb 5133 time taken 0.49 seconds ###### RAA ..################################### 5133 time taken 36.51 seconds 5133 time taken 36.67 seconds 5133 time taken 36.49 seconds Douglas Livingstone wrote: I think this shows the speed of my computer more than anything else: C:\dev>ruby primes.rb 5133 time taken: 2.06 seconds 5133 time taken: 41.82 seconds Florian again 5133 time taken: 41.86 seconds Appending this: puts 'Florian again' # Florian's version b = Time.now.to_f puts Prime.new.inject(0) { |s, x| if x > 50000 then break s else s + 1 end } printf "time taken: %.2f seconds\n", Time.now.to_f-b To test this: > >Yeah, but that way's pretty slow. > > > It get's faster the second time you do it. Douglas On 6/26/05, Florian Frank wrote: > Joe Van Dyk wrote: > [...] > > And my output of your program is: > > 5133 > time taken: 0.86 seconds > 5133 > time taken: 0.44 seconds > > What's wrong with your computer? > > -- > Florian Frank > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --0-379824569-1119755488=:32238--