Abstract Optimizing component interaction is a fundamental problem in constructing efficient component-oriented programs. This paper lays out a foundation for reformulating the implementation of the interaction between components, with the goal of optimizing the assembled system. Our approach amounts to automatically choosing among a number of candidate implementation alternatives for each of the data structures and communication mechanisms that the components use during their interactions. In this paper we show how to transform one example of component interaction optimization into a graph problem, and discuss an efficient algorithm to solve it. 1 Optimization — A New Opportunity The field of compiler-performed optimization is the study of automatically improving code at a more detailed level than human programmers should have to be concerned with. In the 1960’s, people observed how one could speed up, by hand, programs written in the high-level languages of the day (e.g. FORTRAN). Much of the work since then on compiler-performed analysis and optimization has been driven by the problems encountered in trying to do as well as, or even better than, humans can do by hand. The generic fragments of assembly-language code, generated from templates by the naive compiler, need to be specialized by the optimizer in the context of the overall program. Today, people benefit from programming in higher-level languages than were available in the 1960’s. But, one of the big productivity improvements is not in the base language itself; rather, it is in the fact that the language makes it practical to provide a vast assortment of components on which the programmer can draw. These components can be made available as constituents of libraries, or as services accessible over a network. Compiler-performed optimization today needs to consider libraries and components, not just generic code fragments, and cause them to perform more efficiently in the overall context in which they are invoked. In the 1960’s and 1970’s it was observed that a good programmer (read: assembly-language coder) could take a program written in a high-level language, and with knowledge of the context in which a loop was used, improve the efficiency of the code of that loop by a factor of two or three. Today, it is observed that it is not uncommon for a programmer, by invoking different components, or by invoking them in different ways, or even by altering the implementation of a component, to improve program efficiency by two or three decimal orders of magnitude ! The authors hope that this paper will be the beginning of the studies that will allow optimizers of the future to get that kind of performance improvement, without humans having to understand the internals of the components, just as programmers today do not have to examine the internals of the assembly-language code generated by a compiler. 2 Performance Implications of Component Assembly Assembly of components is becoming an increasingly common approach to software development in the software industry. This is due in large part to the promise of considerably more productive programming. This increase in productivity is at least partly due to a greater degree of independence or isolation between the development of one component and the development of other components, as well as independence from the development of the larger overall assembly itself. Users of a component need only be concerned with its interface — the abstraction or function it provides — and need not be aware of the implementation underlying that function. Developers of a component need not be aware of the bigger picture of its use — their implementation simply needs to fulfill the functional obligations of the contract constituted by its interface. Different components can be developed by different teams, at different times, at different vendors or enterprises. In addition to increased productivity, component assembly allows a level of inter- and intra-company integration that is so important in an Internet world, by allowing the use of the same componentry by different organizations. Finally, component assembly allows the creation of programs having more functionality than could otherwise be economically achieved. Paradoxically, however, precisely that independence that contributes to productivity and integration, unfortunately also gives rise to poor performance. Choosing among candidate components without considering how well their internal behavior Karin Högstedt AT&T Labs - Research Florham Park, NJ 1 karin@research.att.com Doug Kimelman, V.T. Rajan, Tova Roth, Mark Wegman IBM Thomas J. Watson Research Center Hawthorne, NY {dnk,vtrajan,tova,wegman} @watson.ibm.com Nan Wang University of Maryland 1 nwang@cs.umd.edu Optimizing Component Interaction 1 Work performed while at IBM T.J.Watson Research Center