There’s been quite a bit of talk about Ruby’s speed and how it is below par, to which the stock answer in ruby-talk is: “depends on what you want to do. 99% of the time it is fast enough”.
Personally I have never had a performance problem with applications written in Ruby and I usually don’t notice or attempt to optimize unless there is a noticeable – and by noticeable I mean noticeable by the user – delay.
I couldn’t help but notice though a difference in performance while processing XML with REXML between OS X and Windows. I mean I really couldn’t help noticing it because it was such a big diference.
Some data: the application parses a 3.2MB XML file and lets several XPath expressions roll over it.
Two of those expressions are //element_name expressions, meaning the whole document is searched without skipping any elements.
Here are the results of the same unit test on
OS X
[20070906 16:00:39] INFO: Product groups parsed in 4.142405 seconds
[20070906 16:00:43] INFO: Activity groups parsed in 4.319004 seconds
and
Windows XP
[20070906 16:01:49] INFO: Product groups parsed in 15.142 seconds
[20070906 16:02:07] INFO: Activity groups parsed in 18.497 seconds
Windows runs in a Parallels VM with Coherence enabled and 850 MB of memory.
Even considering the drop in performance the VM incurs, a factor of 4 is a bit much.
The results have been consistent and the difference has been consistent as the load on my Mac increases (I’m showing here the worst case where Visual Studio is running on the VM and OS X has about 12 programs active).
In the best case with everything off, Windows is a factor of 3.5 times slower (clocking at about 7.5 seconds for that particular test).
Ofcourse I need to take into account that I have different Ruby versions (1.8.5 on OS X and 1.8.6 on XP).
I think I’ll look further into this.