May 21st, 2007

not interested

Not fast enough?

Firstly the disclaimer: this is a very geek-heavy post. If this isn't your thing, move along.

Recently there was another outbreak of the Ruby isn't fast enough thread on RubyTalk. This topic is a perennial favourite with visiting Java/Perl/Python hackers and usually focuses on the inadequaces of the current C implementation of the language, which is an old-style interpreter as opposed to a shiny modern (well, modern in 1965) virtual machine.

Personally I don't see the point of these mine is bigger than yours arguments that go on between zealous proponents of various languages as they miss the real issue of speed: which language is most semantically efficient for solving a particular problem, and whether or not that semantic efficiency scales to other problem categories. Anything beyond that is a matter of individual implementation and thus tractable to improvement.

Collapse )

The state of play with Ruby is becoming increasingy complicated. The baseline implementation is known as MRI (Matz's Ruby Implementation) and is a pure C tokenising interpreter which aids portability, then there's JRuby for the Java Virtual Machine, Microsoft has announced IronRuby for the CLR and Queensland University of Technology have their Gardens Point .NET compiler. Getting a genuine feel for the speed of Ruby code is thus becoming increasingly difficult, but I think MRI is still a good place to focus our attention as it provides support for the widest range of platforms and is by far the most widely used at the time of writing.

Collapse )

Of course the performance of mathematical operations is lousy compared to a compiled language like C, but that point has already been covered so I won't belabour it: if you want super-fast math with MRI you should code it in a C extension. The important point is that on modern hardware the number of operations that can be performed per second is more than adequate to build interactive applications of some complexity - for example a spreadsheet package suited to everyday business use is a credible concept. That surely makes MRI fast enough?

Collapse )

It's my belief that one day it will be just as plausible to develop an operating system, a device controller or a next-generation 3D game in Ruby as in C/C++/C# or Java. The question is not when that will happen or why, but rather what form appropriate runtimes need to take and how they will be developed. This is a debate that needs to be going on now whilst Ruby is still on the fringe of the mainstream, before the current perceptions of it as a web application and scripting language become firmly entrenched. Such ghettoisation would be a sad fate for a language of such expressive power and beauty, just as previous generations turned away from Smalltalk and Forth in favour of static typing.