Faster Multiplication Fixnum in Ruby?

using ruby ​​1.9.2p290 (2011-07-09 version 32553) [x86_64-linux]

I did a lot of profiling, and it seems to me that Ruby Fixnum propagation is very slow.

After some profiling, I found out that this is (partially), because every call to Fixnum # * includes 6 calls to the core # kind_of .

I know that you can write C extensions, but these multiplications spread throughout the code. So, is there anyway to avoid this overhead inside Ruby?

thank

+5
source share
2 answers

I seriously doubt that these measurements are accurate for several reasons:

+5

, , . GSL libray, , Fixnum # * , : https://github.com/romanbsd/rb-gsl/blob/master/lib/gsl/oper.rb#L15

... ... 6 ​​# kind_of? ol '.

, , , .

+2

All Articles