Software performance matters

The issue with the soon-to-come generation of Windows mobile computers (tablets) of performance versus productivity, when it comes to software development, looms on all of us programmers who desire to write software for Windows 8. As a longtime Windows API programmer I appear to be in the minority, but I just can't help but ask the question: "Do programmers just not get it?"

I have watched the video of a talk by Microsoft's Herb Sutter entitled "Why C++?" more than once and even though I don't use C++, I just can't help but appreciate his points about the importance of performance, especially when it comes to the next generation of mobile devices.

He discusses the importance of performance from tablet computers to large datacenters. He uses terms like performance per watt , performance per dollar and performance per cycle (how much work can you get from the hardware). He even comments about how in a datacenter, the performance of software can have an effect on up to 80 percent of the total cost to run the datacenter (better software uses less power and requires less hardware).

OK, folks, this guy is an expert in the industry, so don't listen to me. He definitely is on to something here, and I am not convinced that most programmers grasp it fully yet.

The Problem Is Not the Hardware, But the Software

Manufacturers of computer hardware for years have frantically tried to keep pace, pushing each new generation further and further. I can remember developing software for computers, with a 20MB (not a typo) hard drive or just floppy drives and no hard drive at all. Memory counted in kilobytes. A fast CPU ran at 25 MHz.

Let's be honest here. When it comes to computers we have come a long way. Today, CPUs are in the gigahertz range, and they have an onboard cache with more memory than the entire computer had back in those days. Hard drives are now come with terabytes of space. RAM memory is in the gigabytes. So hardware manufacturers, give yourself a pat on the back, because you have done an amazing job of pushing the maximum. It is time programmers stop picking on companies like Intel with their Atom CPU.

The so called "Moore's Law", at some point will reach an end most likely. Even Herb Sutter admits this. At some point performance of software will be what really matters. Programmers just don't seem to get this though. I don't understand it personally. Let me give you an example of how programmers may not fully appreciate how performance is really achieved.


Read the comments to some of my other articles and more than once you will see someone post how the latest managed (.NET) programming languages solve the problem with slow software, by providing the asynchronous calls to object methods (subroutines or functions). The idea is that because Windows is a multitasking operating system and most CPUs today are multicore, that if some part of the software is too slow or takes too long to run, a programmer can just pass this code on to a separate thread (running asynchronously or at the same time) , which is then simply passed on to another core of the CPU and everything is solved. Now you have "fast and fluid" software.

The truth is that such programming techniques simply pass the buck back to the hardware, expecting it to solve the programmers' problems. The technique of using threads is nothing new. Multi-threading has been in Windows for many, many years and experienced programmers knew how and when to tap into multithreading.

Multithreading does not speed up software. It simply forces a computer to do two tasks at one time, simply by switching between them so fast you don't notice the switch. But no matter how you word it, the computer is trying to do two tasks, rather than just one, which means more work, not less and the switching process has overhead, which means even more work.

To illustrate. Consider someone who is a juggler. It is not easy to juggle two balls. But as the juggler starts adding more balls, things start getting harder and harder. Each new ball added significantly increases the complexity of the task. You see a juggler only has two hands and each hand can only handle one ball at a time. The same holds true with computers. No matter how many cores a CPU has, at some point you are handling more tasks than the number of CPU cores you have. Each core can only handle one task at a time. Now a CPU may be optimized to do some things in parallel within itself, but even there it has limits. The point is that just like the juggler, a computer can do only so much work.

Sutter in his talk tries to tell us that performance still matters and will matter even more in the future. Why? Mobile computers, because of their small form factor, have less power and resources, so they have to be used carefully. Computers where form factor is not an issue, like data centers, do more work today, not less, so hardware is being pushed to the limit.

But look how far computer hardware has come in just a few decades. The problem is not with computer hardware failing to keeping pace, but it is with how we design software and our lack of appreciation for using limited resources effectively. Programmers just don't get it. We can't keep blaming the hardware or just keep passing the buck to the hardware. Performance is our problem to solve, but sadly it is a low priority for many.

A Lesson From Old Timers

Programmers who date back to the days of DOS or earlier are often looked upon as relics in this modern age. Some of them still use command line compilers, rather than the latest studio development environment. Whether businesses or the enterprise realize it or not, there is a great asset there that could and should be tapped into. Such programmers likely know what it means to get every last bit of power out of a computer. They know what it means to work with limited memory. They know what it means to count CPU cycles. They may still use a stop watch to time how long some code takes to run.

Such talent is rare today, in my opinion. Programmers, no matter what development language they use, who know how to write software with performance in mind, are valuable to the industry. When I wrote my article about sending programmers to Walmart to buy their computers, few who commented could appreciate the purpose behind it. They just don't get the point. Some of what I was saying was in jest. I don't expect programmers to use low-power computers. The mindset matters -- that performance is important. Whatever it takes, even making a programmer use a less-powerful computer, to help him or her see the importance of performance can be beneficial.

Get Back to the Basics

The programming world may be just so wrapped up in the latest technologies, the latest frameworks, the latest development studios thinking it all makes us more productive, while forgetting what a computer really is and how it really works. Just mention the word "assembler" or "machine language" and some programmers may just shudder! They may think such terms belong in the Dark Ages. Well, guess what? That is how a computer actually works under the hood. Everything we develop using high-level tools eventually will be executed on a computer at the lowest level, which is machine language. What we design using any high-level tool or language, must some how become machine language.

This is why old timers moved away from interpreted languages in favor of compilers. While a scripting language can be useful in some contexts, remember it takes longer for scripting to run than pure machine language. While I don't expect us all to go back to assembler, nor do I feel that scripting languages have no value, it is still important to remember to always count the cost of how we develop software. Productivity is important too, but not at the cost of all performance. Actually productivity tools designed with performance in mind can be very powerful. Even scripting languages can be optimized for speed and performance.

But programmers have to always keep performance in mind.  Just because computers appear to have extra power (or resources) to spare, does not mean that programmers should not care about developing fast software that uses minimal resources. Maybe we just need to get back to the basics. Performance matters.

Photo Credit: Jose Gil/Shutterstock

Chris Boss is an advanced Windows API programmer and developer of 10 year-old EZGUI, which is now version 5. He owns The Computer Workshop, which opened for businesses in the late 1980s. He originally developed custom software for local businesses. Now he develops programming tools for use with the PowerBasic compiler.

© 1998-2020 BetaNews, Inc. All Rights Reserved. Privacy Policy - Cookie Policy.