Saturday, July 21, 2007

"Programmers are expensive, CPUs are cheap" does not justify rapid development of slow code

If you've seen at least one argument between a Ruby on Rails Fanboy and an Enterprise Java Fundamentalist - you've heard something like this:
"RoR is 100 times slower than Java."
"Developers are expensive and CPU cycles are cheap. It's more important to save developer time than CPU time!"
"You aren't a real developer!!"
"At least I don't use tables!!!"

I am troubled by how pervasive this "I'm expensive, CPUs are cheap, I don't need to concern myself with performance" attitude has become. Comparing the relative costs of processing cycles vs. a developer is just silly.

Everyone knows, and CPUs are cheap. This is obviously true. Developers like to point this out right before they tell you interpreted languages are better, or OR Mapping is better, or loose typing is better. Like stating the obvious will somehow qualify their point of view. Could anyone who likes to spout this please stop! You might as well say "Puppies are cute, roaches are ugly. Python is better than C++" or "Rocks are harder than pillows, pointers are evil".

First of all, it's not the development cost vs. operational costs. You have to consider how often the product is going to be operated. Think of it this way - "Automobile engineers cost 100k a year. Gas costs $3 a gallon. Engineers are way more expensive than gas. Who cares that it only gets 5MPG, or engineers were able to design the car twice as fast." If your product is successful, there should be many more man-hours of operation than there were development.

Secondly, CPU cycles are inconsequential when measuring the "cost" of slower code. How about the value of our customers' time waiting on all those extra CPU cycles? Think of it this way - "Engineers are expensive, electricity is cheap. It doesn't matter that our microwaves take twice as long to pop popcorn, we saved a lot of money developing them." People don't care about CPU cycles, but they do care deeply about their time. Imaging trying to use the argument on the other end: you are demoing your latest project to the big-wigs for the first time:

"And there you have it, what do you think."
"It feels slow."
"Don't worry, CPU cycles are cheap."

Please note: I am a big fan of interpreted languages and loose typing. These technologies are great and there are many situations where they are the most appropriate tools.

But, please, stop with the "Developers are expensive, cycles are cheap" bullshit. That's about as insightful as pointing out bananas are yellow and lettuce is green. The trade-off for slower code isn't just so-cheap-they're-free CPU cycles, it's your customers' TIME, and that is very expensive.



Well said. Where do you live? Do you want a job?


Hi Boyd,
Thanks for reading! I live in Dallas and don't need a job right now. Feel free to my linkedin network:


Remember, the code gets run thousands of times. (All according to the scale of the project)

When developing a high traffic site it is worth spending extra time optimizing your code. Yahoo even has a department dedicated to optimization( , which has built several tools (like YSlow: and gives presentations on speeding up sites.

Now of course if you are coding a site for a few people only (or if you're not coding for a server) there is less need for optimizing.