http://qs1969.pair.com?node_id=681218


in reply to CPU cycles DO NOT MATTER!

What if the code is running on far more than 50 machines? If I save 10% on 500 machines or 1% on 5,000 machines, is that worthwhile?

I think Kernighan and Pike came up with the best metric for when to optimize in The Practice of Programming. They say that the time spent optimizing should never outweigh the run time saved through optimization unless you're against a hard deadline the software can't meet.

You might want to weight this for the price of computer time vs. programmer time, so if your programmer's time is worth $50k a year and the computer time spent running the software is $5k a year, don't let them spend more than a man month optimizing. Since the computer will probably get upgraded at some point, make it 2 man weeks. This way, your $2k investment in your programmers pays off the first year and to some extent every year after.

For a program that runs on one machine once in a while, throw hardware at it. For something that's the sole application of a farm of hundreds of servers, you might save tens of of thousands of dollars every year by spending a man week doing the simple, obvious optimizations.