3 ms·
> And lastly, this isn’t meant to be a prescriptive post, > but we all know why micro-optimizing is usually a > mistake: it wastes your time, it’s easy
by stcredzero 16y ago
> And lastly, this isn’t meant to be a prescriptive post,
> but we all know why micro-optimizing is usually a
> mistake: it wastes your time, it’s easy to screw up
> (see question 5), and it *typically* produces no
> measurable speedup.
I emphasized the typically because this is a key idea: you are fallible -- deal with it!
I visited a local hacker-space with a friend of mine to talk about a project of ours. A bunch of those guys are NASA and they know quite a bit about how to engineer for reliability. Since our project involved a lot of soldering, he suggested that we estimate our average solder join failure rate and use that as the number of expected failures to look for. That's what he does in his personal projects.
I exclaimed that was brilliant, then was a little embarrassed. Of course! Duh! I know I'm not perfect and I'm smart enough to have deduced that I have something like an average failure rate for solder joins. So why have I been proceeding for years and years as if I could just do everything perfectly if I just tried hard enough?
Every new function you write is a risk. Minimize your risks. Maximize the cost/benefit. Every routine you optimize is a risk. Minimize your risks. Maximize cost/benefit.
One's problems as a programmer are more likely the result of excess hubris and not insufficient smarts.
EDIT: Fear is as big a problem as hubris. Walk the middle path. You are your own optimization problem, and the optimal solution is almost never a no-brainer shove of a lever all the way in some direction.
- flogic 16y agoThat's awesome. I'm always impressed by the reliability work that comes out of NASA. I don't regret a single penny of my tax dollars which goes to them just for this sort of thing alone.