Environmentally friendly programming

According to legend Steve Jobs once motivated his programmers to quicken the boot sequence of the Mac by calculating how many lives that would save when all those precious seconds are summed up over a year. This way of adding up saved time is perhaps more often used to point out how much time you waste waiting for things. Which in all honesty is a more realistic way to see it. But both views are pretty pointless. We all understand that no real lives are saved and those days, months or even years spent waiting can only be spent on something else if we could save it all in one go. Which we can’t. There is however another way to look at this when it comes to computers and programming…

A computer running a program will use more energy than an idle computer. Not that much, but more. Therefore, adding up time saved when optimizing code can be directly converted into lower power consumption. This is a very real effect and unlike the examples above, energy savings can be added up and have a very real impact on the environment and our lives.

This is where environmentally friendly programming comes into the picture. As an IT consultant I’ve come across (and sometimes produced) code that is far from perfect as far as algorithms and memory usage is concerned. Now, in your average program this might not be a big issue performance wise. On a modern computer, performing a linear search on a small collection might only take a fraction of a second longer than a more complex search algorithm and the user will never notice the difference. Therefor, lazy programmers and those rapidly aproaching a project deadline will typically chose the easy path and go with a linear search. But when this code is run several times each day by thousands of user, the fractions of seconds wasted and thus the energy wasted start to add up to something more noticable. Excessive memory usage is also a waste of energy and is often something that can be improved. Selecting all columns from a table when you only need some of them is often justified by reasoning that “you never know when you might need it”. But lets be honest, most likely you wont need it. This means the program will have to allocate and manage a little bit more memory than necessary. Waste of energy!

So, environmentally friendly programming is basically the use of efficient algorithms, restrained memory usage and generally applying all the good old programming practices used back in the days when computers were not so powerful and you had to pay for computer time. We still have to pay. Not with money and not right now…

Last day at work

It is my last day at work today and we will have a small farewell party (as in coffee break with cake). Now, this is nice and all and more or less normal behaviour for any company. But as far as I can tell there are never any welcome parties (once again, coffee and cake)… Maybe I should do something about that on monday when I start my new job…

-“Hello, I’m the new guy. Want some cake?”

Jesfer is online!

Finally this blog is online! Took me some time to find a blog engine that was to my liking, but even more time to get the look and feel right. Not done yet, but good enough to go live 🙂

Next couple of days/weeks/months will be interesting. There seem to be a few settings both in the engine and at my web hotel that could use some tweaking. Nothing major I hope…