Function Adaptation

In order to explore multiple optimization options, a simple and practical solution consists in cloning the code of procedures, applying any complex optimizations to these clones and randomly selecting either the original or transformed procedures at run-time. Obtaining execution time distribution among original and cloned procedures, it is possible to statistically determine the influence of compiler optimizations on the code in a single run. The simplicity of the implementation makes this technique reliable, secure and easy to debug. Yet it enables practical transparent low-overhead continuous optimizations for programs statically compiled with GCC while avoiding complex dynamic recompilation frameworks.

Here is a [attachment:fun-adapt.diff patch] against GCC 4.3 implementing the framework described in the 2007 GCC Summit paper: "Practical Run-time Adaptation with Procedure Cloning to Enable Continuous Collective Compilation".