The "rules" of optimising are a rhetorical device intended to dissuade novice programmers from cluttering up their programs with vain attempts at writing optimal code. They are:
- FirstRuleOfOptimization - Don't.
- SecondRuleOfOptimization - Don't... yet.
- ProfileBeforeOptimizing
It is uncertain at present, whether cute devices such as this have, or ever will, change any attitudes.
It changed mine.
Mine, too.
Source:
MichaelJackson used to say (when asked about optimization):
- Don't.
- Don't Yet (for experts only).
This is republished in
JonBentley's
ProgrammingPearls.
And lets not forget these famous quotes:
-
- "The best is the enemy of the good."
-
- -- MrVoltaire
-
- "More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity."
-
- -- W.A. Wulf
-
- "We should forget about small efficiencies, say about 97% of the time: PrematureOptimization is the root of all evil."
-
- -- DonKnuth (who attributed the observation to CarHoare)
See: OptimizeLater, LazyOptimization, OptimizationUnitTest, OptimizationStories, http://c2.com/cgi/wiki?search=optimiz, UniformlySlowCode, CodeDepreciation, RulesOfOptimizationClub
CategoryOptimization