From: MenTaLguY Date: 2005-11-04T06:36:07+09:00 Subject: Re: Ruby Performance vs. Java On Fri, 2005-11-04 at 05:45 +0900, Robert Bazinet wrote: > I am new to this list and Ruby in general. I had read a blog post recently > that concerned me a bit, > http://www.pankaj-k.net/archives/2005/11/ruby_or_java_a.html. > > The post points out two apps written to do the same task the same way, one > in Java and the other in Ruby. The Java application turned out to be 12x > faster than the Ruby app. I know we are not really comparing apples to > apples here but I was wondering if there are any real-world test results out > there that show Ruby's performance vs. other languages and where Ruby stacks > up. In most cases, the same algorithm implemented in Java and in Ruby is going to be faster/more memory-efficient in Java, at least with the current Ruby implementation (there is no "Ruby VM" as the author supposes; the current interpreter just walks an AST). However, Ruby can often make more efficient algorithms easier to write and use (hence the performance benefits that have been observed with Rails). If speed is your most important criterion, for which all others must be sacrificed, Ruby is (probably) not the right language; but usually there are other factors, like programmer time -- especially for personal projects!. In those cases, the analysis that needs to be made is whether a language is fast enough for your specific task. If anyone offers you a universally applicable "performance metric", it is an illusion. -mental