Skip to main content

Optimising Recursive Functions Yielding Multiple Results in Tuples in a Lazy Functional Language

  • Conference paper
Implementation of Functional Languages (IFL 1999)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1868))

Included in the following conference series:

  • 214 Accesses

Abstract

We discuss a new optimisation for recursive functions yielding multiple results in tuples for lazy functional languages, like Clean and Haskell. This optimisation improves the execution time of such functions and also reduces the amount of memory allocated in the heap by these functions, which reduces garbage collection costs. In some cases execution time is improved by more than a factor of two and allocation costs by a factor of four. Furthermore, the space leak that is caused by selector nodes is removed.

This is achieved by reusing nodes allocated in the previous iteration of the recursion to create the nodes for the next iteration, by updating these nodes. Only the parts of the nodes that have changed are updated. Because of these updates, the code that is used to select an element of a tuple is not executed anymore for many selections, because the selector node was overwritten with a new selector node or the result before it is evaluated.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. van Groningen, J.H.G., Nöcker, E.G.J.M.H., Smetsers, J.E.W.: Efficient Heap Management in the Concrete ABC Machine. Proceedings of the Third International Workshop on the Implementation of Functional Languages on Parallel Architectures. Technical Report Series CSTR 91-07. University of Southampton. U.K. (1991)

    Google Scholar 

  2. Hughes, J.: The design and implementation of programming languages. PhD thesis. Oxford University, Programming Research Group, technical monograph PRG-40 (July 1983)

    Google Scholar 

  3. Nöcker, E.G.J.M.H.: Efficient Parallel Functional Programming - Some Case Studies. In: Proceedings of the Fifth International Workshop on Implementation of Functional Languages, Nijmegen, The Netherlands, pp. 51-68 (September 1993) Technical Report 93-21

    Google Scholar 

  4. Jones, S.L.P.: The implementation of Functional Programming Languages. Prentice-Hall, Englewood Cliffs (1987)

    MATH  Google Scholar 

  5. Sanders, P., Runciman, C.: LZW Text Compression in Haskell. In: Glasgow Workshop on Functional Programming, Ayr. Scotland, pp. 215–226 (1992)

    Google Scholar 

  6. Smetsers, J.E.W., Nöcker, E.G.J.M.H., van Groningen, J.H.G., Plasmeijer, M.J.: Generating Efficient Code for Lazy Functional Languages. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 592–617. Springer, Heidelberg (1991)

    Google Scholar 

  7. Sparud, J.: Fixing Some Space Leaks without a Garbage Collector. In: FPCA 1993, Copenhagen, Denmark, pp. 117–122. ACM press, New York (1993)

    Google Scholar 

  8. Stoye, W.: The implementation of functional languages using custom hardware. PhD thesis. Cambridge University, Computing Laboratory, technical report 81 (December 1985)

    Google Scholar 

  9. Turner, D.: A proposal concerning the dragging problem, Burroughs ARC internal report (October 1985)

    Google Scholar 

  10. Wadler, P.: Fixing some space leaks with a garbage collector. Software Practice and Experience 18(9), 595–608 (1987)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2000 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

van Groningen, J.H.G. (2000). Optimising Recursive Functions Yielding Multiple Results in Tuples in a Lazy Functional Language. In: Koopman, P., Clack, C. (eds) Implementation of Functional Languages. IFL 1999. Lecture Notes in Computer Science, vol 1868. Springer, Berlin, Heidelberg. https://doi.org/10.1007/10722298_4

Download citation

  • DOI: https://doi.org/10.1007/10722298_4

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-67864-9

  • Online ISBN: 978-3-540-44658-3

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics