Composing Transformations for Instrumentation and Optimization

Michael Gorbovitski, Yanhong A. Liu, Scott D. Stoller, Tom Rothamel

When transforming programs for complex instrumentation and optimization, it is essential to understand the effect of the transformations, to best optimize the transformed programs, and to speedup the transformation process. This paper describes a powerful method for composing transformation rules to achieve these goals.

We specify the transformations declaratively as instrumentation rules and invariant rules, the latter for transforming complex queries in instrumentation and in programs into efficient incremental computations. Our method automatically composes the transformation rules and optimizes the composed rules before applying the optimized composed rules. The method allows (1) the effect of transformations to be accumulated in composed rules and thus easy to see, (2) the replacements in composed rules to be optimized without the difficulty of achieving the optimization on large transformed programs, and (3) the transformation process to be sped up by applying a composed rule in one pass of program analyses and transformations instead of applying the original rules in multiple passes.

We have implemented the method for Python, and successfully used it for instrumentation in ranking peers in BitTorrent, and for optimization of complex queries in the instrumentation of BitTorrent, in evaluating connections of network hosts using NetFlow, and in generating efficient implementations of Constrained RBAC. We present experimental results that demonstrate the benefits and effectiveness of the method.