Next: Summary Up: Some Notes on Previous: Structured Programming

Optimization

In general, let your compiler worry about optimizing your code. Help the compiler by writing in a consistent way. Read the documentation of your compiler to see what it can do. If you try to do part of the optimization yourself, you might only make your code harder to understand for the compiler.

If you have to compromise the programming principles outlined in the previous sections to improve performance, do it with care. Only do it for the most time-consuming parts of your program, which are usually only a small part of the program. Only make modifications for performance reasons after you have the program working and completely debugged. Then only make changes that have a dramatic effect. After all, if you can wait 10 hours for the results of your program, the sky will probably not come down if it takes 15 instead. If you have to run the program twice since there was a bug the first time, that advantage is also quickly lost.

Describe the modifications you made in the comment block at the start of the program.


Next: Summary Up: Some Notes on Previous: Structured Programming