Joel On Ruby Performance

Ruby Joel Spolsky follows up on his earlier remarks about scaling out a Ruby on Rails site with this post on Ruby performance.  I’m afraid it is a thoroughly unconvincing and surprising argument.  He states...

I understand the philosophy that developer cycles are more important than cpu cycles, but frankly that’s just a bumper-sticker slogan and not fair to the people who are complaining about performance.

A bumper-sticker slogan?  That’s a surprising statement considering that FogBugz is not written entirely in C.  Is it because Wasabi compiled to PHP or VBScript is saving CPU cycles?  Hardly.

As one might expect from a well designed application, FogBugz is written in a productive high-level language for the very reason that Ruby advocates push ruby - it saves developer cycles and thus money.

Also as one would expect from a well written application, in the few cases where performance is a problem, those particular features were written with a lower-level high performance language.

So why wouldn’t this approach apply to Ruby?  From the tenor of his post, Joel seems to indicate that those who choose to implement their enterprise applications on Ruby are so religiously blinded by the benefits of Rails that they would never dare allow the impurity of non-Ruby code to enter the boundary of their architecture.

Really now?

To his credit, Joel states at the end...

In the meantime I stand by my claim that it's not appropriate for every situation.

And this is true. It may not work well for that computation intensive Bayesian filter.  But is anyone making the claim that Ruby is appropriate for every situation?  The claim I’ve heard is that it is certainly appropriate for many more situations than Joel gives credit for.  I believe that.

Update: Related Links

tags: , , ,

What others have said

Requesting Gravatar... Dave Sep 13, 2006 1:43 PM
# re: Joel On Ruby Performance
For the CPU-intensive stuff, why not go native? And for that matter, why not a natively-compiled Ruby extension? I've done it with Ruby's RegEx interface because Java's was too slow for my purposes, and it's screaming fast at some pretty heavyweight recursive RegEx parsing on long strings. If it's just one or even a few areas that have the need for speed, isolate them and use a native dll. You can save dev AND cpu cycles...
Requesting Gravatar... Ryan Smith Sep 13, 2006 6:58 PM
# re: Joel On Ruby Performance
I love all the conversations going on right now around Ruby performance and Spolsky's rants about it.

I personally don't use Ruby, not because it's slow or anything like that, but because there isn't much demand for it yet.

I think the "bumper-sticker slogan" comment is just stupid. One of the programmers that I learned under got me so wrapped around performance issues that I still find myself burning a bunch of time trying to figure out how to write code in the most optimal way.

Truth be told, it's very rarely an issue, and when it is it's very easy to go back and refactor just the code that is necessary.

Bottom line: It's always cheaper to throw money at faster hardware than it is to spend on developer hours.
Requesting Gravatar... you've been HAACKED Sep 13, 2006 9:11 PM
# I'd Like To Be In Joel's Shoes
I'd Like To Be In Joel's Shoes
Requesting Gravatar... lb Sep 13, 2006 9:21 PM
# re: Joel On Ruby Performance
>In the meantime I stand by my claim
>that it's not appropriate for every
>situation.

in this conclusion he's reduced his argument to a completely meaningless generalization. really pointless ending there. i wish i could edit his article wikipedia style.
Requesting Gravatar... jjh Sep 14, 2006 11:02 AM
# re: Joel On Ruby Performance
Ryan: Bottom line: It's always cheaper to throw money at faster hardware than it is to spend on developer hours.

I had to respond to this, because while I think your are correct for most applications, there are some applications that throwing more hardware at the problem becomes impossible. We have a few apps that each run on a single domain E25K. These problems should have been refactored long ago to make better use of commodity hardware so horizontal scaling would have been possible.

My bottom line: beware of using absolutes like "always" when debating an issue. :)
Requesting Gravatar... Sam Sep 14, 2006 11:05 AM
# re: Joel On Ruby Performance
Wow, you Ruby people are seriously uptight. I know it's hard to imagine, but it's is POSSIBLE that Ruby has flaws. It is, in fact, one of the slowest languages in existence, for example. (True fact. If you don't believe me, then look at the language shoot-out data yourself: http://shootout.alioth.debian.org/)

Before you guys get your panties in a bundle, you should remember that when Java was the new kid on the block that people ragged on it relentlessly regarding its slow performance. The performance of Java has improved tremendously since those days. Java is now a very fast language and can compete with the likes of C and C++ on most benchmarks.

If Ruby fanatics want to be taken seriously, you better start fully embracing the flaws of the language otherwise nobody is going to believe anything you say. Every article I read these days on Ruby or Rails makes me seriously question everything that's said because I know Rubyists always gloss over anything that can possibly be construed as negative.

Requesting Gravatar... michael eaton Sep 15, 2006 10:45 AM
# On Joel,
On Joel,
Requesting Gravatar... leemic Oct 03, 2006 6:26 AM
# Ruby is slow - that's the fact and let's improve on it
I am not going to rant - Joel has a point - It looks like Ruby has not been optimized - period.

Let's put it this way - I just created a simple script that takes in tab-delimited format and converted to pipe delimited format - yes - I'm newbie - after running it through ruby - it took one hour. So I rewrote using perl - it ran about 30% to 35% faster. I checked CPU usage - both of them are pegging one CPU.
I ran through profile - no obvious bottle neck.

I also tried to use 'ActiveRecord' of Rails as standalone library - the performance was awful for doing millions inserts - At first I thought it could be DB - but after duck-typing the connector not to send any SQL to server [ eliminate actual database call ], it did not reduce the runtime - only by 10% to 15%. So I digged deeper and found out that it was spending a lot of time on 'Interger#gcd' which was called by Rational object. Playing around the code - I found the culprit - DateTime. I was using one field - datetime and creating dynamic SQL just gets killed by DateTime. After removing DateTime - the performance was acceptable - I switched to Time object - the performance was still descent. DateTime is not optimized.

I'm about to give up using Ruby for my dataware house project. I am going back to either Perl or Java - probably Java because b/c it has concurrent library [ Doug Lea - you are the man ] so I can run parsing and db call via separate native threads. It is sad - I really liked 'duck-typing.

Requesting Gravatar... Joseph Oct 30, 2008 9:22 PM
# re: Joel On Ruby Performance
Joel is wrong about one thing though - Duck typing is not the culprit. If it was, Javascript would have the same problem. (And it did; until next gen javascript engines appeared.

I'm looking forward to runtimes like the V8 javascript engine to be ported to Ruby. Then we'll really see some performance out it.
Requesting Gravatar... Alex May 03, 2009 2:13 PM
# re: Joel On Ruby Performance
Ruby performance sucks, but I still use Ruby a lot. I really hope performance will improve with time though.

What do you have to say?

(will show your gravatar)
Please add 8 and 1 and type the answer here: