Pretty much by accident I just discovered this video on YouTube, in which James Gosling, inventor of the Java programming language, basically badmouthes Ruby and it's lack of scalability. Twitter (which is written in Ruby) has had some issues, so he might have a point there. But what struck me was the following sentence: "dynamic typing in terms of raw execution performance costs you between one and two orders of magnitude in performance". I usually try not to disagree with people who are between one and two orders of magnitude smarter than me, but in this case I have to.

When Java came out in 1995, it didn't have the high-performance VM it has now. In fact, it was strictly bytecode-interpreted and it had a non-generational garbage collector that would freeze the application whenever a collection was taking place. Java was pretty slow in the beginning and it was often made fun of for that reason. In fact, even today many (ignorant) people associate Java with unresponsive applications. Ultimately, Sun realized that the performance wasn't good enough and so they bought the company that originally developed the Hotspot VM. The funny thing is that many of the concepts that make the Hotspot VM so great were actually inspired by technologies that were originally developed for dynamic languages such as Self (which now is conveniently developed at Sun) and Smalltalk.

Dynamic typing is in fact associated with a performance penalty, but most of this penalty can be overcome by using things like compile-time type-inference and tracing JIT compilers. James Gosling of all people should know that runtime performance isn't a black-and-white thing. A few years ago everybody thought virtual function calls were "several orders of magnitude" slower than static function calls. Now we have tracing JIT-compilers that can inline these calls. To me, it seems like the formerly bullied now becomes a bully himself (just like in real life). Or in other words: shit rolls downhill.