Re:Projects That Are Making Fast Ruby a Reality
by ch4s3 on Thursday February 11, 2016 @02:08PM
(#11082304)
>>Were the "Ruby will always be slow" people simply wrong?
Well, yes. It was slow in the same way that python was slow. If you move all of the slow stuff to C or JIT it or whatever, it can be as fast as almost any language can be, with a few minor caveats.
MAth is tricky in pure Ruby for example, the spec does a check on integers to make sure they can ben contained in what we'll call Int, and don't need to be transformed into BigInt. Ruby does this check every time an integer changes, which is wildly expensive, but super convenient. Its really nice for small N, but you shouldn't add n-dimensional arrays this way.
Also, run time meta-programming is pretty slow, especially if you lean on #method_missing, that's hard to fix.
Those two things aside, there aren't any reasons that Ruby can't be made much faster, in fact for many use cases JRuby is presently very fast and with Java interop you can leverage Java libs.
MAth is tricky in pure Ruby for example, the spec does a check on integers to make sure they can ben contained in what we'll call Int, and don't need to be transformed into BigInt. Ruby does this check every time an integer changes, which is wildly expensive, but super convenient. Its really nice for small N, but you shouldn't add n-dimensional arrays this way.
Also, run time meta-programming is pretty slow, especially if you lean on #method_missing, that's hard to fix.
Those two things aside, there aren't any reasons that Ruby can't be made much faster, in fact for many use cases JRuby is presently very fast and with Java interop you can leverage Java libs.