Project

General

Profile

Feature #2561

1.8.7 Patch reduces time cost of Rational operations by 50%.

Added by kstephens (Kurt Stephens) almost 11 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:27437]

Description

=begin
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.
=end


Files

rational_performance.rb (1.85 KB) rational_performance.rb kstephens (Kurt Stephens), 01/06/2010 10:58 AM
ruby-1.8.7-rational.patch (9.1 KB) ruby-1.8.7-rational.patch kstephens (Kurt Stephens), 01/06/2010 10:58 AM
rational_performance.rb (2.29 KB) rational_performance.rb kstephens (Kurt Stephens), 01/07/2010 03:43 AM
ruby-1.8.7-rational.patch (9.39 KB) ruby-1.8.7-rational.patch kstephens (Kurt Stephens), 01/07/2010 03:43 AM
ruby-1.8.7-rational.patch (10.7 KB) ruby-1.8.7-rational.patch Fixed Fixnum#gcd for FIXNUM_MIN. kstephens (Kurt Stephens), 01/12/2010 01:18 AM
gcd_test.rb (21.6 KB) gcd_test.rb kstephens (Kurt Stephens), 01/12/2010 01:18 AM
gcd_test.rb (44.6 KB) gcd_test.rb 64-bit test cases. kstephens (Kurt Stephens), 01/22/2010 05:58 AM
ruby-1.8.7-fixnum_gcd.patch (1.28 KB) ruby-1.8.7-fixnum_gcd.patch numeric.c patch. kstephens (Kurt Stephens), 01/22/2010 05:58 AM

Related issues

Has duplicate Ruby 1.8 - Backport #838: faster gcd for 187Closedknu (Akinori MUSHA)12/08/2008Actions

Also available in: Atom PDF