Question

People are talking about dynamic optimization in compilers.What does it mean? Can anyone give me a fair idea about it?

Was it helpful?

Solution

Static optimization is based on the program code itself. Alternatively, dynamic optimization is based on code execution results. For example, having a long switch statement in C/C++, it would be possible to optimize it by changing case operators order. To do this, it is necessary to run the program many times and keep this switch operator statistics.

Some modern compilers contain such optimization framework, which allows to run the program and save its runtime statistics. Then the program code is optimized by using this statistics.

See, for example, VC++ Profile-Guided Optimizations: http://msdn.microsoft.com/en-us/library/e7k32f4k.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top