Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Ruby be compiled and faster in the future? [closed]

C, Java, C# and Python are compiled from the beginning. Thanks to Facebook, PHP is now also compilable and can be run on HHVM increasing performance of programs. Ruby is not compilable and is slower than aforementioned languages. Is is possible that Ruby will be compilable in the future (like PHP with HHVM)? Or maybe there are some reasons it cannot be?

like image 699
iwis Avatar asked Nov 03 '15 20:11

iwis


1 Answers

The question makes false statements/assumptions.

  1. All of the language you mentioned (C, Java, C#, Python, and Ruby) are compiled. The difference is when they are compiled (runtime vs precompiled).
  2. Ruby can be precompiled to bytecode as of 1.9
  3. Ruby is not "slower" than the other language just because it is typically compiled at runtime (this is a major misconception). The code will startup faster if it is precompiled, but precompiling the code will not make it run any faster.
like image 180
Mike S Avatar answered Oct 17 '22 06:10

Mike S