An experimental analysis of self-adjusting computation

Recent work on adaptive functional programming (AFP) developed techniques for writing programs that can respond to modifications to their data by performing change propagation. To achieve this, executions of programs are represented with dynamic dependence graphs (DDGs) that record data dependences and control dependences in a way that a change-propagation algorithm can update the computation as if the program were from scratch, by re-executing only the parts of the computation affected by the changes. Since change-propagation only re-executes parts of the computation, it can respond to certain incremental modifications asymptotically faster than recomputing from scratch, potentially offering significant speedups. Such asymptotic speedups, however, are rare: for many computations and modifications, change propagation is no faster than recomputing from scratch. In this article, we realize a duality between dynamic dependence graphs and memoization, and combine them to give a change-propagation algorithm that can dramatically increase computation reuse. The key idea is to use DDGs to identify and re-execute the parts of the computation that are affected by modifications, while using memoization to identify the parts of the computation that remain unaffected by the changes. We refer to this approach as self-adjusting computation. Since DDGs are imperative, but (traditional) memoization requires purely functional computation, reusing computation correctly via memoization becomes a challenge. We overcome this challenge with a technique for remembering and reusing not just the results of function calls (as in conventional memoization), but their executions represented with DDGs. We show that the proposed approach is realistic by describing a library for self-adjusting computation, presenting efficient algorithms for realizing the library, and describing and evaluating an implementation. Our experimental evaluation with a variety of applications, ranging from simple list primitives to more sophisticated computational geometry algorithms, shows that the approach is effective in practice: compared to recomputing from-scratch; self-adjusting programs respond to small modifications to their data orders of magnitude faster.

[1]  Umut A. Acar,et al.  CEAL: a C-based language for self-adjusting computation , 2009, PLDI '09.

[2]  Mikkel Thorup,et al.  Poly-logarithmic deterministic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge, and biconnectivity , 2001, JACM.

[3]  Leonidas J. Guibas,et al.  A package for exact kinetic data structures and sweepline algorithms , 2007, Comput. Geom..

[4]  Jon Louis Bentley,et al.  Decomposable Searching Problems I: Static-to-Dynamic Transformation , 1980, J. Algorithms.

[5]  Jon Doyle A truth maintenance system , 1981 .

[6]  R. Hoover Incremental graph evaluation (attribute grammar) , 1987 .

[7]  Guy E. Blelloch,et al.  An experimental analysis of self-adjusting computation , 2006, PLDI '06.

[8]  Robert E. Tarjan,et al.  Self-adjusting top trees , 2005, SODA '05.

[9]  Larry Carter,et al.  New classes and applications of hash functions , 1979, 20th Annual Symposium on Foundations of Computer Science (sfcs 1979).

[10]  Leonidas J. Guibas,et al.  Kinetic data structures in practice , 2007 .

[11]  DONALD MICHIE,et al.  “Memo” Functions and Machine Learning , 1968, Nature.

[12]  David G. Kirkpatrick,et al.  The Ultimate Planar Convex Hull Algorithm? , 1986, SIAM J. Comput..

[13]  R. Bellman Dynamic programming. , 1957, Science.

[14]  J. Boissonnat,et al.  Algorithmic Geometry: Frontmatter , 1998 .

[15]  Paul F. Dietz,et al.  Two algorithms for maintaining order in a list , 1987, STOC.

[16]  John McCarthy,et al.  A BASIS FOR A MATHEMATICAL THEORY OF COMPUTATION 1) , 2018 .

[17]  Analysis and caching of dependencies , 1996, ICFP '96.

[18]  Umut A. Acar,et al.  A cost semantics for self-adjusting computation , 2009, POPL '09.

[19]  G.S. Brodal,et al.  Dynamic planar convex hull , 2002, The 43rd Annual IEEE Symposium on Foundations of Computer Science, 2002. Proceedings..

[20]  R. Tamassia,et al.  Dynamic expression trees and their applications , 1991, SODA '91.

[21]  Timothy M. Chan Dynamic planar convex hull operations in near-logarithmic amortized time , 1999, 40th Annual Symposium on Foundations of Computer Science (Cat. No.99CB37039).

[22]  Gerald J. Sussman,et al.  Forward Reasoning and Dependency-Directed Backtracking in a System for Computer-Aided Circuit Analysis , 1976, Artif. Intell..

[23]  John Henry Field Incremental reduction in the lambda calculus and related reduction systems , 1991 .

[24]  Monika Henzinger,et al.  Maintaining Minimum Spanning Trees in Dynamic Graphs , 1997, ICALP.

[25]  Guy E. Blelloch,et al.  Adaptive functional programming , 2006 .

[26]  Rafael Dueire Lins,et al.  Garbage collection: algorithms for automatic dynamic memory management , 1996 .

[27]  Thomas W. Reps,et al.  A categorized bibliography on incremental computation , 1993, POPL '93.

[28]  Raman Srinivas Sundaresh Incremental computation via partial evaluation , 1992 .

[29]  Umut A. Acar,et al.  A Consistent Semantics of Self-adjusting Computation , 2007, ESOP.

[30]  Robert E. Tarjan,et al.  A data structure for dynamic trees , 1981, STOC '81.

[31]  Roberto Tamassia,et al.  Dynamic algorithms in computational geometry , 1992, Proc. IEEE.

[32]  Greg N. Frederickson,et al.  A data structure for dynamically maintaining rooted trees , 1997, SODA '93.

[33]  Robert E. Tarjan,et al.  Dynamic trees in practice , 2007, JEAL.

[34]  Ronald L. Graham,et al.  An Efficient Algorithm for Determining the Convex Hull of a Finite Planar Set , 1972, Inf. Process. Lett..

[35]  Donald Ervin Knuth,et al.  The Art of Computer Programming , 1968 .

[36]  Jon Louis Bentley,et al.  Transforming static data structures to dynamic structures , 1979, 20th Annual Symposium on Foundations of Computer Science (sfcs 1979).

[37]  Guy E. Blelloch,et al.  Robust Kinetic Convex Hulls in 3D , 2008, ESA.

[38]  Umut A. Acar,et al.  Imperative self-adjusting computation , 2008, POPL '08.

[39]  David Eppstein,et al.  Sparsification—a technique for speeding up dynamic graph algorithms , 1997, JACM.

[40]  Jan van Leeuwen,et al.  Maintenance of Configurations in the Plane , 1981, J. Comput. Syst. Sci..

[41]  Leonidas J. Guibas,et al.  Kinetic data structures: a state of the art report , 1998 .

[42]  Greg N. Frederickson,et al.  Data Structures for On-Line Updating of Minimum Spanning Trees, with Applications , 1985, SIAM J. Comput..

[43]  Umut A. Acar,et al.  Adaptive Bayesian inference , 2007, NIPS 2007.

[44]  David P. Dobkin,et al.  The quickhull algorithm for convex hulls , 1996, TOMS.

[45]  Donald E. Knuth,et al.  The art of computer programming, volume 3: (2nd ed.) sorting and searching , 1998 .

[46]  Roger Hoover Incremental Graph Evaluation , 1987 .

[47]  Haim Kaplan,et al.  Kinetic and Dynamic Data Structures for Convex Hulls and Upper Envelopes , 2005, WADS.

[48]  Leonidas J. Guibas,et al.  An empirical comparison of techniques for updating Delaunay triangulations , 2004, SCG '04.

[49]  Binay K. Bhattacharya,et al.  On a Simple, Practical, Optimal, Output-Sensitive Randomized Planar Convex Hull Algorithm , 1997, J. Algorithms.

[50]  William Pugh,et al.  Incremental computation via function caching , 1989, POPL '89.

[51]  Richard Cole,et al.  Two Simplified Algorithms for Maintaining Order in a List , 2002, ESA.

[52]  Mariette Yvinec,et al.  Algorithmic geometry , 1998 .

[53]  Guy E. Blelloch,et al.  A Library for Self-Adjusting Computation , 2006, Electron. Notes Theor. Comput. Sci..

[54]  David Eppstein,et al.  Dynamic graph algorithms , 2010 .

[55]  Umut A. Acar,et al.  Memory management for self-adjusting computation , 2008, ISMM '08.

[56]  Tim Teitelbaum,et al.  Incremental reduction in the lambda calculus , 1990, LISP and Functional Programming.

[57]  J. Saxe,et al.  Transforming Static Data Structures to Dynamic Structures (Abridged Version) , 1979, FOCS 1979.

[58]  Robert Harper Self-adjusting computation , 2004, LICS 2004.

[59]  Umut A. Acar,et al.  Compiling self-adjusting programs with continuations , 2008, ICFP 2008.

[60]  Tomasz Radzik Implementation of dynamic trees with in-subtree operations , 1998, JEAL.

[61]  Guy E. Blelloch,et al.  Selective memoization , 2003, POPL '03.

[62]  Ketan Mulmuley,et al.  Computational geometry : an introduction through randomized algorithms , 1993 .

[63]  Magnus Carlsson Monads for incremental computing , 2002, ICFP '02.

[64]  Umut A. Acar Self-adjusting computation: (an overview) , 2009, PEPM '09.

[65]  Robert E. Tarjan,et al.  Dynamic trees as search trees via euler tours, applied to the network simplex algorithm , 1997, Math. Program..

[66]  David A. McAllester Truth Maintenance , 1990, AAAI.

[67]  Leonidas J. Guibas,et al.  Data Structures for Mobile Data , 1997, J. Algorithms.

[68]  Mikkel Thorup,et al.  Maintaining information in fully dynamic trees with top trees , 2003, TALG.

[69]  Thomas W. Reps,et al.  Incremental evaluation for attribute grammars with application to syntax-directed editors , 1981, POPL '81.

[70]  Mikkel Thorup,et al.  Minimizing Diameters of Dynamic Trees , 1997, ICALP.

[71]  Guy E. Blelloch,et al.  Dynamizing static algorithms, with applications to dynamic trees and history independence , 2004, SODA '04.

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

[73]  Robert E. Tarjan,et al.  Self-adjusting binary search trees , 1985, JACM.

[74]  Leonidas J. Guibas,et al.  Algorithmic issues in modeling motion , 2002, CSUR.

[75]  Allan Heydon,et al.  Caching function calls using precise dependencies , 2000, PLDI '00.

[76]  Rastislav Bodík,et al.  DITTO: automatic incrementalization of data structure invariant checks (in Java) , 2007, PLDI '07.

[77]  Timothy M. Chan Optimal output-sensitive convex hull algorithms in two and three dimensions , 1996, Discret. Comput. Geom..

[78]  Thomas W. Reps Optimal-time incremental semantic analysis for syntax-directed editors , 1982, POPL '82.