Changes

Jump to navigation Jump to search
754 bytes added ,  18:58, April 5, 2012
optimisation can cause problems
Line 9: Line 9:  
| accessdate = 2012-04-02}}</ref> Some errors only occur under very specific circumstances and may never be detected.
 
| accessdate = 2012-04-02}}</ref> Some errors only occur under very specific circumstances and may never be detected.
   −
Some compilers just perform a fast simple-minded translation from high-level source code to low-level machine language, while other compilers may optionally take (much) longer to perform the compilation by trying to improve or optimise the resulting machine code.
+
Some compilers just perform a fast simple-minded translation from high-level source code to low-level machine language, while other compilers may optionally take (much) longer to perform the compilation by trying to improve or optimise the resulting machine code.  
    
==History==
 
==History==
Line 110: Line 110:     
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'.
 +
 +
Note that the most important criteria for judging a compiler is that it be correct, i.e. it always produces a correct translation of the high-level language, regardless of the amount of optimisation performed. The documentation for some compilers warns that results may be slightly different and/or that certain code may be incorrectly translated at high levels of optimisation.<ref>{{cite web
 +
| url = http://www.google.co.uk/url?sa=t&rct=j&q=IBM+fortran+compiler+optimisation+level&source=web&cd=3&ved=0CEgQFjAC&url=http%3A%2F%2Fwww-01.ibm.com%2Fsupport%2Fdocview.wss%3Fuid%3Dswg27005174%26aid%3D1&ei=K-Z9T8XAKMWI8gOx76WYDg&usg=AFQjCNEGkE1JxTZVDkQvuwRK39y037UorA
 +
| title = Code optimization with the IBM XL Compilers
 +
| accessdate = 2012-04-05}}</ref> 
    
Such optimisations generally make the resulting machine code 'better', for some definition of 'better':
 
Such optimisations generally make the resulting machine code 'better', for some definition of 'better':
SkipCaptcha
265

edits

Navigation menu