Thursday, September 30, 2010

Early Optimization

The quote "Early optimization is the root of all evil." was said by C.A.R. (Tony) Hoare, but is often attributed to Donald Knuth.

Reference: http://en.wikipedia.org/wiki/Optimization_(computer_science)


The following is a list of some typical 
(but not necessarily bad) pre-optimizations:
   1) Denormalizing Database Tables 
      (i.e. duplicating data)
   2) Exposing implementation detail
   3) Caching (i.e. duplicating data)
   4) Avoiding in-memory copies 
      (Usually has no performance impact)
   5) Copy on Writes (COW); 
      Penalties for Multithhreading even for 
      single threading 
      (See More Exceptional C++)
   6) Skipping Interface Design 
      (Usually causing implementation detail
      leaks and unnecessary dependencies)
   7) Putting multiple purposes in a 
      function/class.
   8) Inlining (Increasing dependencies)
   9) Inlining assembly 
      (Usually has no performance impact)
  10) Using arrays instead of vectors.
  11) Using char* instead of string
  12) Increasing coupling
  13) Decreasing cohesion
  14) Unrolling loops
  15) Macro usage to inline code, or build tables.

No comments:

Post a Comment