Optimize the Most Significant Parts

There’s a general principle to optimization that many people miss, but seems so simple once you know it. I’m sure I first read about it in The Practice of Programming from Kernighan and Pike. You should optimize the most significant part of a program to get the most reward for your effort. The procedure is simple. Measure how much time the computer spends in each part of your program. There’s likely a loop that takes up a significant portion of the time. Optimize that part first. If you don’t follow this formula, you’ll probably spend a bunch of time optimizing what you intuitively think is slow, but it may not matter at all.

I’ve found that this approach applies equally well to optimizing money. For example, when you’re running a business, you have a range of expenses. Some of them are for tangible goods, some of them are for outside services and some of them are for salaries. Imagine an office with a fancy coffee maker. Everyone might think it’s a waste of money and a luxury, but the cost of that expense is likely minuscule compared to salaries. You’re usually better off figuring out how to improve efficiencies in your work process than going with cheapo amenities.

Of course, once you know how this work, you can use it deceptively. Politicians do it all the time. Watch how they talk about earmarks, or the apocryphal $100 hammer. You might agree that it’s not a good idea for a congressman to request a $1mil earmark for his wife’s employer, but even $1mil is nothing compared to the most significant costs to the U.S. budget: Social Security and Medicare. If you check the measurements, you’ll find that all the earmarks together total about 1% of the budget, which Social Security and Medicare are about a third. (Total federal spending is about $2.9tril, and Social Security plus Medicare is about $900mil).

I’m a relatively young person in my late 30s. I wonder if I’m not alone in counting on getting absolutely nothing from Social Security by the time I might need it. I’m not taking that chance. I’m saving money in a 401K plus whatever else I can beyond the annual limit of a 401K. I really wouldn’t mind if my taxes were 30% lower and I had to take responsibility for my own retirement.

Both comments and pings are currently closed.

Comments are closed.

Subscribe to RSS Feed Follow me on Twitter!