Program optimization using indexed and recursive data structures

This paper describes a systematic method for optimizing recursive functions using both indexed and recursive data structures. The method is based on two critical ideas: first, determining a minimal input increment operation so as to compute a function on repeatedly incremented input; second, determining appropriate additional values to maintain in appropriate data structures, based on what values are needed in computation on an incremented input and how these values can be established and accessed. Once these two are determined, the method extends the original program to return the additional values, derives an incremental version of the extended program, and forms an optimized program that repeatedly calls the incremental program. The method can derive all dynamic programming algorithms found in standard algorithm textbooks. There are many previous methods for deriving efficient algorithms, but none is as simple, general, and systematic as ours.

[1]  William Pugh,et al.  A practical algorithm for exact array dependence analysis , 1992, CACM.

[2]  Yanhong A. Liu,et al.  Optimizing Ackermann's function by incrementalization , 2003, PEPM.

[3]  Helmuth Partsch,et al.  Specification and Transformation of Programs - A Formal Approach to Software Development , 1990, Texts and Monographs in Computer Science.

[4]  Alfred V. Aho,et al.  The Design and Analysis of Computer Algorithms , 1974 .

[5]  Yanhong A. Liu,et al.  Systematic Derivation of Incremental Programs , 1995, Sci. Comput. Program..

[6]  J. H. Ahrens,et al.  Merging and Sorting Applied to the Zero-One Knapsack Problem , 1975, Oper. Res..

[7]  Alberto Pettorossi,et al.  A powerful strategy for deriving efficient programs by transformation , 1984, LFP '84.

[8]  Yanhong A. Liu,et al.  From recursion to iteration: what are the optimizations? , 1999, PEPM '00.

[9]  Richard S. Bird,et al.  Tabulation Techniques for Recursive Programs , 1980, CSUR.

[10]  Robert Paige,et al.  Finite Differencing of Computable Expressions , 1982, TOPL.

[11]  Wei-Ngan Chin,et al.  Tupling Functions with Multiple Recursion Parameters , 1993, WSA.

[12]  Raghu Ramakrishnan,et al.  Review - Magic Sets and Other Strange Ways to Implement Logic Programs , 1999, ACM SIGMOD Digit. Rev..

[13]  Richard S. Bird,et al.  Algebra of programming , 1997, Prentice Hall International series in computer science.

[14]  Friedrich L. Bauer,et al.  Algorithmic Language and Program Development , 1982, Texts and Monographs in Computer Science.

[15]  David A. McAllester On the complexity analysis of static analyses , 1999, JACM.

[16]  Yanhong A. Liu,et al.  Efficiency by Incrementalization: An Introduction , 2000, High. Order Symb. Comput..

[17]  Richard S. Bird The promotion and accumulation strategies in transformational programming , 1984, TOPL.

[18]  Jeffrey F. Naughton,et al.  Bottom-Up Evaluation of Logic Programs , 1991, Computational Logic - Essays in Honor of Alan Robinson.

[19]  Erik Poll,et al.  Algebra of Programming by Richard Bird and Oege de Moor, Prentice Hall, 1996 (dated 1997). , 1999 .

[20]  Oege de Moor A Generic Program for Sequential Decision Processes , 1995, PLILP.

[21]  Yanhong A. Liu,et al.  Dynamic Programming via Static Incrementalization , 1999, High. Order Symb. Comput..

[22]  David Maier,et al.  Magic sets and other strange ways to implement logic programs (extended abstract) , 1985, PODS '86.

[23]  Robert Paige,et al.  Real-time Simulation of a Set Machine on a Ram , 1989 .

[24]  Wei-Ngan Chin,et al.  A bounds inference method for vector-based memoization , 1997, ICFP '97.

[25]  Yanhong A. Liu,et al.  Static caching for incremental computation , 1998, TOPL.

[26]  Harald Ganzinger,et al.  A New Meta-complexity Theorem for Bottom-Up Logic Programs , 2001, IJCAR.

[27]  Alberto Pettorossi,et al.  Program derivation via list introduction , 1997, Algorithmic Languages and Calculi.

[28]  Adam Brooks Webber,et al.  Optimization of functional programs by grammar thinning , 1995, TOPL.

[29]  William L. Scherlis,et al.  Program improvement by internal specialization , 1981, POPL '81.

[30]  Norman H. Cohen Eliminating Redundant Recursive Calls. , 1983, TOPL.

[31]  Nils Klarlund,et al.  MONA Version 1.4 - User Manual , 2001 .

[32]  William Pugh,et al.  The Omega test: A fast and practical integer programming algorithm for dependence analysis , 1991, Proceedings of the 1991 ACM/IEEE Conference on Supercomputing (Supercomputing '91).

[33]  Mitchell Wand,et al.  Recursive programming through table look-up , 1976, SYMSAC '76.

[34]  Douglas R. Smith Structure and Design of Problem Reduction Generators , 1991 .

[35]  Yanhong A. Liu,et al.  Discovering auxiliary information for incremental computation , 1996, POPL '96.

[36]  Sartaj Sahni,et al.  Analysis of algorithms , 2000, Random Struct. Algorithms.