queene - Mobiloitte Blog

Ruby Has Produced Faster Websites than Java. Where Else Is Java Outperformed?

Java has been a long and standalone choice for most developers since it offer best of both worlds – Flexibility and the advantages of cross-platform programming. Still it’s impossible for this framework to play monopoly in the world of web development, not now when new and ambitious players are coming up. Recently I was assigned with a task to migrate a website from JavaScript to Ruby on Rails. Reasons were multiple, but one of them was dominating. Ruby powered websites are faster.

Where else could Ruby  outperform Java? Keep reading!


The basic reasons for the creation of ruby were to reduce inconsistencies, to minimize verbosity (abstracting/hiding boiler plate code), to simplify multifaceted operations, and to reduce programmer errors.

For example, Java has a concept of primitive data types.Integer and int co-exist in the language and programmers need to make sure Object versions of these data types are used in the suitable places. The language does have warnings/errors in place to help the programmer.

Ruby eliminates that need since everything in Ruby is an Object including nulls. Blocks in Ruby simplify iterating and modifying collections among other things. There is significantly less code to maintain, notably code for parsing files, and code for getter/setter methods.

The benefit of Ruby is agility. Projects developed in Ruby frameworks are completed earlier then Java’s. Ruby community has been growing and there are many libraries and frameworks which are named “gems” which are available and supported very well.

On the other hand, Java is a very mature language (despite the fact that they are the same age), it has many libraries and frameworks. It’s amazingly fast and really cross-platform, which is not the case with ruby as it is mostly a Linux way.


The method of execution of code in the two languages presents the real difference between the languages.

Java code is first translated to a virtual machine language (that is, converted to a machine language for a simulated computer). Code executed on this virtual machine executes faster than Ruby’s interpreted code. With the exception of JRuby which is itself implemented in Java. Ruby’s current implementations are interpreted without translating to a virtual machine language first.


Ruby is a dynamically typed language that relies on duck typing as Philip Cunningham use to say in his blogpost. Objects, in the context of an object-oriented program, care less about their type than they do about their public interface. This means that if two different types of objects respond to the same method, the same message can be passed to both of them. As a result, errors are encountered at runtime.

On the other hand Java is a statically typed language, i.e. that the compiler will complain if we try to pass a message to an object of a different type than we have unambiguously specified.

To declare that one technology is better than the other is a long discussion and depends on the project’s criteria. No technology is ideal, it is the purpose which decides as to which technology would be the best for that specific purpose. So rather than talking about which technology is best or better suited I would I would like to highlight the contrast among them.

Feel free to ask us more questions on this topic. Also you can have a look at our existing portfolio of Ruby websites.