Why is ruby so slow vs. Javascript in Rhodes application ?

// Expert user has replied.
T Thierry Leloup 3 years 7 months ago
1 1 0

Hello everybody,

We are developing a Rhodes application with a lot of images processing and we had to do some calculations in Javascript because our graphics lib is a Javascript one.
As these calculations took too much time for us, we tried to implement a basic benchmark test in Ruby in order to compare calculation performance.

The benchmark consists in building 2 matrices (1000x1000) with random data and build a third one with a simple M3(x,y) = M1(x,y)*M2(x,y)/255.

Here are the results we got with Rhodes 5.0.30 :
Rhosimulator : Ruby : 194 ms, Javascript : 58 ms
Android : Ruby : 871 ms, Javascript : 259 ms
Windows 8.1 : Ruby : 1801 ms, Javascript : 426 ms
iPhone6 : Ruby : 1700 ms (!!!), Javascript : 134 ms

We really thought Ruby should be faster as, if we understand well, Ruby code is compiled into Ruby-bytecode and then executed by the Rhodes rubyVM interpreter.

So my question is : is Javascript really always faster than Ruby in a Rhodes application and does it mean we should always prefer Javascript when it comes to massive calculation ?

Thanks,
Thierry

Please Register or Login to post a reply

1 Replies

R Robert Galvin

Hi Thierry,

Any chance you can share your app code? I am trying to better understand exactly how you are performing the test?  What version of Android were you using? Was RhoSim running on Mac or Windows?

CONTACT
Can’t find what you’re looking for?