From: mail@... Date: 2015-01-29T22:09:39+00:00 Subject: [ruby-core:67891] [ruby-trunk - Misc #10800] [PRRF][PATCH] Make math.c twice as faster when passed Bignum Issue #10800 has been updated by gogo tanaka. File introduce_num2dbl_with_to_f_func.patch added $ cat bench.rb ```ruby require 'benchmark' puts Benchmark.measure { 10000000.times { Math.cos(1) } } puts Benchmark.measure { 10000000.times { Math.cos((1 << 100)) } } puts Benchmark.measure { 10000000.times { Math.cos(1.0) } } puts Benchmark.measure { 10000000.times { Math.cos(1/3r) } } ``` ## Before ``` 1.370000 0.000000 1.370000 ( 1.379540) 6.700000 0.080000 6.780000 ( 7.085635) 1.380000 0.020000 1.400000 ( 1.484075) 6.460000 0.110000 6.570000 ( 7.262271) ``` ## After ``` 1.370000 0.000000 1.370000 ( 1.391781) 3.590000 0.020000 3.610000 ( 3.650833) 1.400000 0.010000 1.410000 ( 1.416726) 6.110000 0.040000 6.150000 ( 6.208570) ``` ---------------------------------------- Misc #10800: [PRRF][PATCH] Make math.c twice as faster when passed Bignum https://bugs.ruby-lang.org/issues/10800#change-51290 * Author: gogo tanaka * Status: Open * Priority: Normal * Assignee: ---------------------------------------- This ticket is continued from [Feature 10785](https://bugs.ruby-lang.org/issues/10785) My patch last time is only for Fixnum, but now I'd like to do same thing for Bignum without loosing others performance. And this time I follow [r49434](https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/49434) not to ignore redefinition of Integer#to_f ;) thanks. ---Files-------------------------------- introduce_num2dbl_with_to_f_func.patch (7.38 KB) -- https://bugs.ruby-lang.org/