All this was summed up by famous computer scientist Michael A. Jackson
In his "Two rules of when to optimize"
(Principles of Program Design, 1975)