From: Steve Klabnik Date: 2010-11-04T03:11:23+09:00 Subject: Re: Ruby Perofrmance --001636c5a258ccc8fb049429f724 Content-Type: text/plain; charset=ISO-8859-1 Like most things, "Ruby is slow" doesn't have a black and white answer. You've gotta know a little bit of history. Ruby 1.8.x is called "MRI," for "Matz's Ruby Interpreter." Now, Matz is a great language *designer*, but a mediocre*interpreter implementor*. So, starting with Ruby 1.9, we have "YARV," (or sometimes 'KRI') which is 'yet another ruby vm' or 'koichi's ruby interpreter'. It's been totally re-written by people who actually care about making Ruby as fast as possible. So the 1.8 to 1.9 gap is pretty big, check it out: http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=ruby&lang2=yarv That's not even taking into account the other Ruby implementations, such as Rubinius, which uses a JIT, and is already pretty damn fast, or JRuby, which is currently the fastest Ruby implementation. Another component of "Ruby is slow" is the whole "does it matter?" question. I use Ruby mostly in a web context, and so my database calls tend to be the slowest point of any given request, not Ruby itself. Basic Amdahl's law stuff; an infinitely fast Ruby would only be marginally better at serving pages. Even for most desktop apps, we're increasingly in a world of 2GHz mutli-core wonder machines, and the difference in microbenchmarks just doesn't actually matter. That's not to say that it NEVER does; my kernel project, for example, isn't in Ruby, that'd be silly. I would never use Ruby for scientific computing, or crunching really large numbers. My startup does some file processing stuff; most of the site is in Rails, but that processing is done in C. It just makes sense. The last component is "Why is Ruby kinda slow?" Because Ruby is possibly the most dynamic language ever created, it's a fucking *nightmare* to optimize. All of those wonderful features that let me develop things really quickly and have really clean, beautiful code are an absolute bitch from an implementation standpoint. I can give you a few examples if you're curious, I don't know how much of a compiler/language geek you are. Anyway, I'm almost rambling. If you want to know anything else / get some clarification, ask away. Ruby is my favorite language (followed closely by Haskell), so anything to help spread awareness and shine some light on the actual details! --001636c5a258ccc8fb049429f724--