Delphi's code optimization results in more efficient code operation and size (faster and smaller .exe), but it can be confusing during debugging. For example:

- Delphi will create no code for what it sees as "redundant" lines, such as a variable assignment when that variable is not used. - Occasionally the compiler's optimization may cause the code to execute in an unexpected order. - Optimization will sometimes prevent you from examining the value of a variable, such as not showing a variable's value via the Run/Evaluate/Modify dialog or while hovering over the variable with the cursor.

Conclusion: for using Delphi's built-in debugger efficiently, turn optimization "off" as long as you're debugging. Only switch it "on" again for your last compilation (and after that, test your application thoroughly).