Skip to main content

Improved Fusion for Optimizing Generics

  • Conference paper
Practical Aspects of Declarative Languages (PADL 2005)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 3350))

Included in the following conference series:

Abstract

Generic programming is accepted by the functional programming community as a valuable tool for program development. Several functional languages have adopted the generic scheme of type-indexed values. This scheme works by specialization of a generic function to a concrete type. However, the generated code is extremely inefficient compared to its hand-written counterpart. The performance penalty is so big that the practical usefulness of generic programming is compromised. In this paper we present an optimization algorithm that is able to completely eliminate the overhead introduced by the specialization scheme for a large class of generic functions. The presented technique is based on consumer–producer elimination as exploited by fusion, a standard general purpose optimization method. We show that our algorithm is able to optimize many practical examples of generic functions.

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. Alimarine, A., Smetsers, S.: Fusing generic functions. Technical report NIII-R0434, University of Nijmegen (September 2004)

    Google Scholar 

  2. Alimarine, A., Smetsers, S.: Optimizing generic functions. In: Kozen, D. (ed.) MPC 2004. LNCS, vol. 3125, pp. 16–31. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  3. van Arkel, D., van Groningen, J., Smetsers, S.: Fusion in practice. In: Peña, R., Arts, T. (eds.) IFL 2002. LNCS, vol. 2670, pp. 51–67. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  4. Chin, W.-N.: Safe fusion of functional expressions II: further improvements. Journal of Functional Programming 4(4), 515–555 (1994)

    Article  Google Scholar 

  5. Chin, W.-N., Khoo, S.-C.: Better consumers for program specializations. Journal of Functional and Logic Programming (4) (November 1996)

    Google Scholar 

  6. Hinze, R.: Generic programs and proofs. Habilitationsschrift, Universitat Bonn (October 2000)

    Google Scholar 

  7. Hinze, R., Jones, S.P.: Derivable type classes. In Hutton, G. (ed.): In: Proceedings of the 2000 ACM SIGPLAN Haskell Workshop. Electronic Notes in Theoretical Computer Science, vol. 41.1. Elsevier Science, Amsterdam (2001); The preliminary proceedings appeared as a University of Nottingham technical report

    Google Scholar 

  8. Jansson, P., Jeuring, J.: Polyp - a polytypic programming language extension. In: The 24th ACM Symposium on Principles of Programming Languages, POPL 1997, pp. 470–482. ACM Press, New York (1997)

    Chapter  Google Scholar 

  9. Wadler, P.: Deforestation: transforming programs to eliminate trees. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, pp. 344–358. Springer, Heidelberg (1988)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2005 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Alimarine, A., Smetsers, S. (2005). Improved Fusion for Optimizing Generics. In: Hermenegildo, M.V., Cabeza, D. (eds) Practical Aspects of Declarative Languages. PADL 2005. Lecture Notes in Computer Science, vol 3350. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-30557-6_16

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-30557-6_16

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-24362-5

  • Online ISBN: 978-3-540-30557-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics