From: Hal Fulton Date: 2003-09-22T10:50:41+09:00 Subject: Re: Performance: Ruby vs Java Lalit Pant wrote: > I'm a newcomer to Ruby, and thought I would write a little > brute-force-search program to see how Ruby compares to Java - > performance wise. The results surprised me (I was hoping Ruby would > fare a lot better than it did!). On my WinXP box (AthlonXP 1800+, > 768Meg RAM), the Ruby program takes 1min 50secs to complete, while a > similar java program takes 0.6 secs. [snip] This *must* be a JIT issue, since the difference is so big. I compared the Ruby version to the C version (below) and got a comparable ratio. I bet you will, too. Bottom line: Ruby is slower because it doesn't do any JIT. Other factors might be the lack of bytecode compilation and the startup time of the interpreter (though Java has that, too). Some JIT implementations are pretty good. I once had to do a little demonstration to prove to my officemate that a program (similar to this one) actually ran faster in Java than in C. Of course, that's highly dependent on the compilers, the nature of the code, your default optimizations, and the phase of the moon. Hal