Code Optimization Techniques in Source Transformations for Interpreted Languages.




A common approach to implement automatic differentiation (AD) is based on source-to-source transformation. In contrast to the standard case in mathematical software that is concerned with compiled languages, AD for interpreted languages is considered. Here, techniques to improve code performance are introduced in transformations on a high-level rather than by an optimizing compiler carrying out these transformations on a lower-level intermediate representation. The languages MATLAB and CapeML are taken as examples to demonstrate these issues and quantify performance differences of codes generated by the AD tools ADiMat and ADiCape using the five code optimization techniques constant folding, loop unrolling, constant propagation, forward substitution, and common subexpression elimination.