Changes

Jump to navigation Jump to search
533 bytes added ,  14:47, April 4, 2012
→‎Optimisation: advice on optimisation
Line 98: Line 98:     
==Optimisation==
 
==Optimisation==
 +
In a long-running calculation, the choice of a good algorithm is essential. Changing to a better algorithm can often provide much better performance gains than is possible with compiler optimisation.
 +
 +
Programs often obey the 80-20 rule, where 20% of the code accounts for 80% of the CPU usage. Programmers usually do a poor job of guessing as to which 20% of the code is causing performance problems, so before doing any hand optimisation it is crucial to (use a tool to) measure the program performance and identify the hot spots.
 +
 
Many compilers have one or more optional optimisation levels.  As the level/amount of optimisation increases the compiler tends to spend more and more time doing the optimisation.  The word 'optimisation' is perhaps misleading - perfect optimisation is a very hard problem ([[NP-complete]] or even [[undecidable]]), so a conceptually better term would be 'improvement'.
 
Many compilers have one or more optional optimisation levels.  As the level/amount of optimisation increases the compiler tends to spend more and more time doing the optimisation.  The word 'optimisation' is perhaps misleading - perfect optimisation is a very hard problem ([[NP-complete]] or even [[undecidable]]), so a conceptually better term would be 'improvement'.
  
SkipCaptcha
265

edits

Navigation menu