Abstract
The array update problem in a purely functional language is the following: once an array is updated, both the original array and the newly updated one must be preserved to maintain referential transparency. We devise a very simple, fully persistent data structure to tackle this problem such that
-
each incremental update costs O(1) worst-case time,
-
a voluminous sequence of r reads cost in total O(r) amortized time, and
-
the data structure use O(n + u) space, where n is the size of the array and u is the total number of updates. A sequence of r reads is voluminous if r is Ω(n) and the sequence of arrays being read forms a path of length O(r) in the version tree. A voluminous sequence of reads may be mixed with updates without affecting either the performance of reads or updates.
An immediate consequence of the above result is that if a functional program is single-threaded, then the data structure provides a simple and efficient implementation of functional arrays. This result is not new. What is new is that many multi-threaded functional array applications also exhibit the incremental updates/voluminous reads execution pattern. Those applications can also be efficiently implemented by the proposed data structure.
A comparison of our method to previous approaches to the array update problem is briefly discussed. Empirical results have been collected to measure the effectiveness of the proposed data structure.
This research has been supported, in part, by the National Science Foundation (#CCR-8909634) and DARPA (DARPA/ONR #N00014-91-J1472).
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
12th Annual ACM Symposium on Principles of Programming Languages. A.C.M., January 1985. New Orleans, Louisiana, U.S.A.
Functional Programming Languages and Computer Architecture. A.C.M./Addison-Wesley, September 1989. Imperial College, London, U.K.
Proceedings of the 1990 ACM Conference on Lisp and Functional Programming. A.C.M., June 1990. Nice, France.
18th Annual ACM Symposium on Principles of Programming Languages. A.C.M., January 1991. Orlando, Florida, U.S.A.
Proceedings of the Symposium on Partial Evaluation and and Semantics-Based Program Manipulation. A.C.M., June 1991. New Haven, Connecticut, U.S.A. Also appears as SIG-PLAN Notices, 26(9), September 1991.
Annika Aasa, Sören Holmström, and Christina Nilsson. An efficiency comparison of some representations of purely functional arrays. BIT, 28(3):490–503, 1988.
Henry G. Baker, Jr. Shallow binding in Lisp 1.5. Communications of the ACM, 21(7):565–569, July 1978.
Henry G. Baker. Shallow binding makes functional arrays fast. SIGPLAN Notices, 26(8):145–147, August 1991.
Adrienne Gael Bloss. Path Analysis and the Optimization of Non-Strict Functional Languages. PhD thesis, Department of Computer Science, Yale University, May 1989. Also appears as report YALEU/DCS/RR-704.
Adrienne Bloss. Update analysis and the efficient implementation of functional aggregates. pages 26–38. In [2]
Frank Dehne, Jörg-Rüdiger Sack, and Nicola Santoro, editors. Algorithms and Data Structures. Ottawa, Canada, August 1989. Lecture Notes in Computer Science, Volume 382, Springer-Verlag.
Paul F. Dietz. Fully persistent arrays. pages 67–74. In [11].
James R. Driscoll, Neil Sarnak, Daniel D. Sleator, and Robert E. Tarjan. Making data structures persistent. Journal of Computer and System Sciences, 38(1):86–124, February 1989.
Juan C. Guzmán and Paul Hudak. Single-threaded polymorphic lambda calculus. In Proceedings of 5th Annual IEEE Symposium on Logic in Computer Science, pages 333–343. I.E.E.E., June 1990.
Sören Holmström. How to handle large data structures in functional languages. In Proceedings of the SERC Chalmers Workshop on Declarative Programming Languages. University College London, 1983.
Paul Hudak and Adrienne Bloss. The aggregate update problem in functional programming systems. pages 300–314. In [1].
Paul Hudak, Simon Peyton Jones, and Philip Wadler, editors. Report on the Programming Language Haskell — A Non-Strict, Purely Functional Language, Version 1.1. August 1991. Available from Yale University and University of Glasgow.
John Hughes. An efficient implementation of purely functional arrays. Technical report, Department of Computer Sciences, Chalmers University of Technology, 1985.
Martin Odersky. How to make destructive updates less destructive. pages 25–36. In [4].
Paul Walton Purdom, Jr. and Cynthia A. Brown. The Analysis of Algorithms. Holt, Rinehart and Winston, 1985.
David A. Schmidt. Detecting global variables in denotational specifications. ACM Transactions on Programming Languages and Systems, 7(2):299–310, April 1985.
J. T. Schwartz. Optimization of very high level languages — i. value transmission and its corollaries. Computer Languages, 1(2):161–194, June 1975.
J. T. Schwartz. Optimization of very high level languages — ii. deducing relationships of inclusion and membership. Computer Languages, 1(3):197–218, September 1975.
Robert Endre Tarjan. Amortized computational complexity. SIAM Journal on Algebraic and Discrete Methods, 6(2):306–318, April 1985.
Philip Wadler. Comprehending monads. pages 61–78. In [3].
Philip Wadler. Is there a use for linear logic? pages 255–273. In [5], 26(9), September 1991.
Stephen Warshall. A theorem on boolean matrices. Journal of the Association for Computing Machinery, 9(1):11–12, January 1962.
Author information
Authors and Affiliations
Corresponding author
Editor information
Rights and permissions
Copyright information
© 1992 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Chuang, TR. (1992). Fully persistent arrays for efficient incremental updates and voluminous reads. In: Krieg-Brückner, B. (eds) ESOP '92. ESOP 1992. Lecture Notes in Computer Science, vol 582. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-55253-7_7
Download citation
DOI: https://doi.org/10.1007/3-540-55253-7_7
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-55253-6
Online ISBN: 978-3-540-46803-5
eBook Packages: Springer Book Archive