From: pejuko Date: 2011-08-18T07:05:28+09:00 Subject: Re: Strangely slow float to int and int to float conversion > small ints are stored _in_ the VALUE pointer so there is no extra allocation necessary. > > floats aren't, so every one you make will be a malloc and set and then that space will be GC'd eventually. > > You're prolly seeing the increase in multiplier by invoking the GC more. Run on a system with a lot of memory and turn off GC to verify. True! When I disabled GC 30_000_000 cycles are on 8s instead of 400s. Good to know that if I want to do such kind of operation in large amount it is good to switch off the GC. Just for comparing, i've done some research with other languages with default GC settings and the (i * 0.3).to_i operation ruby 1.9.2 400s ruby 1.9.3 150s python3 33s perl 25s lua 12s jruby1.6.2 5s and c with -O3 0.08s :-)