Thursday, November 18, 2021

Performance Improvement

One of the fundamental lessons I learned in my days as an Electrical Engineering student is the order that performance improvements should be addressed. Always work on the largest problem first. This is really counterintuitive as people will throw out minor improvements because they are easily seen and understood. Unfortunately the improvements may be so minor that they are imperceptible. Let's look at some examples.

Recently I drove a car from San Mateo, California to Salt Lake City, Utah. This is a great example of performance as you always want to minimize the amount of time spent in the car. There are a number of variables you can play with to decrease the amount of time the trip takes. First off is which route you will take. Interstate 80 is the fastest route but is sometimes closed because of snow. You also have how fast you go. You can drive the speed limit or try to go above it. That introduces a few more variables like gas mileage and the risk of getting pulled over to receive a warning or speeding citation. The faster you drive, the more you will have to stop for gas. Don't forget that you may require additional stops to use the restroom or get food.

Thinking of the driving example, most people will point out that you can save time by combining food and restroom breaks with fuel stops. During my recent trip, I stopped for an hour to sleep and that could have been avoided by leaving earlier in the day. Leaving earlier would have also helped with the gridlock traffic I encountered leaving the Bay Area. Ultimately though, that all had very little effect on the overall drive. The best performance gains on a long trip like that are going to be solved by changing the speed of the trip from 80 miles per hour, the legal speed limit for most of the trip in Nevada and Utah, to 500 miles per hour which is how fast you can make the trip in a commercial plane. That is how I got to San Mateo in the first place and if I didn't have to bring a lot of stuff they don't allow on airplanes, it is how I would have gone home.

Another example of performance improvement I saw came in the form of a National Geographic article. It described how to save water while doing dishes. In many parts of the world, water is a scarce resource. In other parts it falls from the sky in large quantities. The article encouraged everyone to avoid rinsing your dishes before placing them in the dishwasher. No offense National Geographic but if you have a dishwasher, there are significantly better ways to save water. Taking a shorter shower is a good start. Better yet is to water your lawn only when necessary. Not rinsing your dishes saves about 2 gallons of water. Taking a shorter shower will save more than the 2 gallons of water. Watering your lawn only when necessary will save hundreds of gallons of water. In other words, stop worrying about 2 gallons and worry about 100 gallons. Once everyone gets that down, you can worry about smaller amounts.

So what does this have to do with computers? A lot actually. If you find yourself looking to improve performance, look at the system as a whole. Break down the tasks and their various times to complete. If task A takes minutes and task B takes seconds, focus on task A. Don't worry about B as it doesn't really matter until you can get task A into the seconds range.

No comments:

Post a Comment