[#24105] [Bug #1711] Marshal Failing to Round-Trip Certain Recurisve Data Structures — Run Paint Run Run <redmine@...>

Bug #1711: Marshal Failing to Round-Trip Certain Recurisve Data Structures

9 messages 2009/07/01

[#24116] [Bug #1715] Numeric#arg for NaN is Inconsistent Across Versions — Run Paint Run Run <redmine@...>

Bug #1715: Numeric#arg for NaN is Inconsistent Across Versions

10 messages 2009/07/02

[#24240] [Bug #1755] IO#reopen Doesn't Fully Associate with Given Stream on 1.9; Ignores pos on 1.8 — Run Paint Run Run <redmine@...>

Bug #1755: IO#reopen Doesn't Fully Associate with Given Stream on 1.9; Ignores pos on 1.8

8 messages 2009/07/09

[#24321] [Bug #1773] Gem path doesn't honor user gem? — Lin Jen-Shin <redmine@...>

Bug #1773: Gem path doesn't honor user gem?

12 messages 2009/07/14

[#24390] [Feature #1784] More encoding (Big5 series) support? — Lin Jen-Shin <redmine@...>

Feature #1784: More encoding (Big5 series) support?

12 messages 2009/07/16

[#24467] Re: [ruby-cvs:31226] Ruby:r24008 (ruby_1_8_6): Removed private on to_date and to_datetime. — Urabe Shyouhei <shyouhei@...>

Hello.

10 messages 2009/07/21

[#24472] [Feature #1800] rubygems can replace system executable files — Kazuhiro NISHIYAMA <redmine@...>

Feature #1800: rubygems can replace system executable files

13 messages 2009/07/21

[#24530] [Feature #1811] Default BasicSocket.do_not_reverse_lookup to true — Roger Pack <redmine@...>

Feature #1811: Default BasicSocket.do_not_reverse_lookup to true

9 messages 2009/07/23

[#24624] [Bug #1844] Immediates Should Not Respond to :dup — Run Paint Run Run <redmine@...>

Bug #1844: Immediates Should Not Respond to :dup

15 messages 2009/07/30

[ruby-core:24215] Performance issue with Prime class under Ruby 1.8.6 in Windows

From: Srdjan Pejic <spejic@...>
Date: 2009-07-08 21:03:30 UTC
List: ruby-core #24215
Hello all,

I've been encouraged by Gregory Brown of Prawn and Ruby Best Practices fame
to submit an issue to the list for consideration.

A quick background first. In my spare time, I've been solving Project Euler
problems in Ruby as a way of exercising and stretching my coding and math
muscles. The most recent problem I solved is Problem
10<http://projecteuler.net/index.php?section=problems&id=10>: Find sum
of primes below 2 million.

I approached this problem a few different ways: my own solution, a Ruby
standard library solution and my improved solution after studying more math,
etc. What I ran into was surprising. If the limit at which the program stops
finding and computing the primes is greater than 100,000, the Prime class
takes up to 7 times as long as my first crack at the problem (using trial
division) and 30 times as long using an improved solution (Sieve of
Eratosthenes).

I've done two test runs and posted the benchmarks and code here:
http://gist.github.com/142907

I am running this test on Windows XP SP3, 2 GB of RAM and an Intel 2GHz
dual-core processor. The test was run in the irb console.

If you need more information or more runs, please let me know and I will
gladly oblige.

For reference, this solution on Ruby 1.9 running on Mac OS X was submitted
to me by Gregory Brown over Twitter: *time ruby19 -rprime -e
"Prime.take_while { |e| e < 2_000_000 }.inject { |s,r| s + r }" real
0m2.938s*

In This Thread

Prev Next