From: Kurt Stephens Date: 2010-01-06T10:58:23+09:00 Subject: [ruby-core:27437] [Feature #2561] 1.8.7 Patch reduces time cost of Rational operations by 50%. Feature #2561: 1.8.7 Patch reduces time cost of Rational operations by 50%. http://redmine.ruby-lang.org/issues/show/2561 Author: Kurt Stephens Status: Open, Priority: Normal This changes adds a specialize Fixnum#gcd and a tuned rational.rb. Reduced overall time on Rational operations by > 50%.
                                              user     system      total        real
test_it                                  22.380000   2.140000  24.520000 ( 24.559388)
test_it ks_rational                      17.870000   1.830000  19.700000 ( 19.687221)
test_it ks_rational + Fixnum#gcd         10.660000   0.000000  10.660000 ( 10.665765)
The patch will perform better with Fixnum#gcd on numeric.c but still is faster with only the rational.rb changes. I have a version for 1.8.6 if someone wants it. ---------------------------------------- http://redmine.ruby-lang.org