In fact, the two tools perform different and complementary functions. A beneficial side effect of optimization is the ability to write more readable code. Before the widespread use of optimizing compilers, experienced programmers often adopted coding styles that favored better machine code generation over source code readability and maintainability. Alternatively, you could manually insert values for constants and expressions containing constants or use additional temporary variables to take calculations out of loops. Optimizers make such tactics unnecessary, freeing the developer to write more natural, readable code.
Optimization is an analytical process.
After being parsed and analyzed, code is examined to extract the maximum amount of information, which can then be used to improve the code while preserving the programmer's original intent. In typical cases, the greater the scope of optimiz ation, the longer a compiler will take to generate code. You can get more information by examining blocks of code and identifying relationships between variables and expressions, although this takes longer. Global optimization looks at procedures and loops, and takes even more time. The complexity of the optimization also affects overall code-generation speed.