I was reading a blog the other day touting the slowness of Ruby and this concept occurred to me: using "developer efficient" languages is ruining the environment. And if you look around, all of us who use these inefficient technologies are counting on hardware makers improve efficiency so we can continue the habits we prefer. That's just not right.
An Analogy to cars.
Consider for a moment if you're driving a gas-guzzling SUV. You believe that they should just find more oil, or that carmakers are responsible for making cars more efficient. You believe that we should bomb OPEC to get you cheap oil. Anyway you cut it, the responsibility isn't yours.
Or imagine you're somewhat energy conscious and own a fuel efficient car. You desire the electric car, or the solar panel, or fusion. We geeks have been screaming for years that these things need to have time spent on them, yet we ourselves refuse to drive 55mph instead of 70mph, which would use a lot less gas, or take the less convenient but more efficient public transportation around here.
And still carmakers keep churning out gas cars. Why? Because it's easy and it's profitable, and we don't care enough to spend the money to get away from that.
Back to code.
Guess what, we the lazy programmers using AJAX and Ruby on Rails or Python to gain programming efficiency are the same way. If you cared about the environment, you'd use C++, or at least Java or C#.
Face it: every layer added between your code and the hardware costs something once you scale it up, just like it does for a million gasoline cars. In the case of web pages and applications, that something is electricity. Most of which is generated by fossil fuels. Most of which comes from coal mines or oil imports.
If your code is 50% slower than desired on a machine that takes 150w at full load (i'm being generous), that's a wasted 150w, because you need a second box. If your code is 90% as fast, that's still 150 watts wasted -- you still need a second machine to get the same performance as the optimal solution. Those numbers suck.
Right, It's all about Scale
Now imagine you have a farm of these machines.
Now imagine a co-lo the size of Google's site in Oregon filled with that inefficient code.
Now imagine that you've written code that pings the shit out of your machine just to get someone's AJAXy email, or to fill a search box interactively.
The bottom line is that it adds up. Every CPU cycle burned on interpreting your "10x faster to program" scripting language code is a cycle that could have been used to get some work done using a lower level language. And every router or browser client dealing with your bullshit is also wasting electricity in the process.
And if you look at solutions that David Heinemeier Hansson had made for Rails' scalability, they always come back to buying more machines. Yes, I agree that Rails is desirable when compared solely against developer time. However it is NOT desirable when compared over the long term with scalability, air conditioning and electricity costs. If I can do on one sever what it takes to do on 10 with Rails, I would certainly spend the time to do what it takes on one. If the funding wouldn't last long enough, then I guess the idea wasn't that great, now was it?
I guess it all comes back to social responsibility
If you care about the environment, you'll try to make the most efficient software solution to the problem, not just wait for hardware manufacturers to make the uber-efficient hardware solution to accomodate your software programming whims.
If anyone ever reads this post who has a vested interest in Rails, they'll probably be all pissed off and defensive. Well, don't worry, you're not alone. Python is also in that category, and I love Python. Frighteningly, I think the most "green" language out there right now is C++, C or Objective-C, followed by Java and C#. Once you get down to assembly, the amount of energy spent in maintaining the code is probably too high for the energy benefit. It would be interesting to see some real numbers on "green" language choices and development practices.
Save the planet, defeat the terrorists, code in C++. I kind of like the sound of that, even though I don't practice nearly enough myself.
ps - even if you don't believe humans are the cause of global warming, consider the socio-economic reasons to get ourselves off of oil and coal as incentive enough to cut back on fossil fuel use.