Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1291151.1291199acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Stream fusion: from lists to streams to nothing at all

Published: 01 October 2007 Publication History
  • Get Citation Alerts
  • Abstract

    This paper presents an automatic deforestation system, stream fusion, based on equational transformations, that fuses a wider range of functions than existing short-cut fusion systems. In particular, stream fusion is able to fuse zips, left folds and functions over nested lists, including list comprehensions. A distinguishing feature of the framework is its simplicity: by transforming list functions to expose their structure, intermediate values are eliminated by general purpose compiler optimisations.
    We have reimplemented the Haskell standard List library on top of our framework, providing stream fusion for Haskell lists. By allowing a wider range of functions to fuse, we see an increase in the number of occurrences of fusion in typical Haskell programs. We present benchmarks documenting time and space improvements.

    References

    [1]
    Olaf Chitil. Type inference builds a short cut to deforestation. In ICFP '99: Proceedings of the fourth ACM SIGPLAN International Conference on Functional programming, pages 249--260, New York, NY, USA, 1999. ACM Press.
    [2]
    Olaf Chitil. Promoting non-strict programming. In Draft Proceedings of the 18th International Symposium on Implementation and Application of Functional Languages, IFL 2006, pages 512--516, Budapest, Hungary, September 2006. Eotvos Lorand University.
    [3]
    Duncan Coutts, Don Stewart, and Roman Leshchinskiy. Rewriting Haskell strings. In Practical Aspects of Declarative Languages 8th International Symposium, PADL 2007, pages 50--64. Springer-Verlag, January 2007.
    [4]
    Nils Anders Danielsson and Patrik Jansson. Chasing bottoms, a case study in program verification in the presence of partial and infinite values. In Dexter Kozen, editor, Proceedings of the 7th International Conference on Mathematics of Program Construction, MPC 2004, volume 3125 of LNCS, pages 85--109. Springer-Verlag, July 2004.
    [5]
    Jeremy Gibbons. Streaming representation-changers. In D. Kozen, editor, Mathematics of Program Construction, pages 142--168. Springer-Verlag, 2004. LNCS 523.
    [6]
    Jeremy Gibbons and Geraint Jones. The under-appreciated unfold. In ICFP '98: Proceedings of the third ACM SIGPLAN International Conference on Functional programming, pages 273--279, New York, NY, USA, 1998. ACM Press.
    [7]
    Andrew Gill. Cheap Deforestation for Non-strict Functional Languages. PhD thesis, University of Glasgow, January 1996.
    [8]
    Andrew Gill, John Launchbury, and Simon Peyton Jones. A shortcut to deforestation. In Conference on Functional Programming Languages and Computer Architecture, pages 223--232, June 1993.
    [9]
    Zhenjiang Hu, Hideya Iwasaki, and Masato Takeichi. Deriving structural hylomorphisms from recursive definitions. In Proceedings 1st ACM SIGPLAN International Conference on Functional Programming, volume 31(6), pages 73--82. ACM Press, New York, 1996.
    [10]
    Patricia Johann. Short cut fusion: Proved and improved. In SAIG 2001: Proceedings of the Second International Workshop on Semantics, Applications, and Implementation of Program Generation, pages 47--71, London, UK, 2001. Springer-Verlag.
    [11]
    Thomas Johnsson. Lambda lifting: transforming programs to recursive equations. In Functional programming languages and computer architecture. Proc. of a conference (Nancy, France, Sept.1985), New York, NY, USA, 1985. Springer-Verlag Inc.
    [12]
    John Launchbury and Ross Paterson. Parametricity and unboxing with unpointed types. In European Symposium on Programming, pages 204--218, 1996.
    [13]
    John Launchbury and Tim Sheard. Warm fusion: deriving build-catas from recursive definitions. In FPCA '95: Proceedings of the seventh international conference on Functional programming languages and computer architecture, pages 314--323, New York, NY, USA, 1995. ACM Press.
    [14]
    Erik Meijer, Maarten Fokkinga, and Ross Paterson. Functional programming with bananas, lenses, envelopes and barbed wire. In J. Hughes, editor, Proceedings 5th ACM Conf. on Functional Programming Languages and Computer Architecture, FPCA'91, Cambridge, MA, USA, 26-30 Aug 1991, volume 523, pages 124--144. Springer-Verlag, Berlin, 1991.
    [15]
    Will Partain. The nofib benchmark suite of Haskell programs. In Functional Programming, pages 195--202, 1992.
    [16]
    Simon Peyton Jones. Constructor Specialisation for Haskell Programs, 2007. Submitted for publication.
    [17]
    Simon Peyton Jones and André L. M. Santos. A transformation-based optimiser for Haskell. Sci. Comput. Program., 32(1-3): 3--47, 1998. ISSN 0167-6423.
    [18]
    Simon Peyton Jones, Andrew Tolmach, and Tony Hoare. Playing by the rules: rewriting as a practical optimisation technique in GHC. In Ralf Hinze, editor, 2001 Haskell Workshop. ACM SIGPLAN, September 2001.
    [19]
    Simon Peyton Jones et al. The Haskell 98 language and libraries: The revised report. Journal of Functional Programming, 13(1): 0--255, Jan 2003.
    [20]
    Colin Runciman. SmallCheck 0.2: another lightweight testing library in Haskell. http://article.gmane.org/gmane.comp.lang.haskell.general/14461, 2006.
    [21]
    Josef Svenningsson. Shortcut fusion for accumulating parameters & zip-like functions. In ICFP '02: Proceedings of the seventh ACM SIGPLAN International Conference on Functional programming, pages 124--132, New York, NY, USA, 2002. ACM Press.
    [22]
    Akihiko Takano and Erik Meijer. Shortcut deforestation in calculational form. In Conf. Record 7th ACM SIGPLAN/SIGARCH Int. Conf. on Functional Programming Languages and Computer Architecture, FPCA'95, pages 306--313. ACM Press, New York, 1995.
    [23]
    The GHC Team. The Glasgow Haskell Compiler (GHC). http://haskell.org/ghc, 2007.
    [24]
    Philip Wadler. List comprehensions. In Simon Peyton Jones, editor, The implementation of functional programming languages. Prentice Hall, 1987. Chapter 15.
    [25]
    Philip Wadler. Deforestation: transforming programs to eliminate trees. Theoretical Computer Science, (Special issue of selected papers from 2nd European Symposium on Programming), 73(2):231--248, 1990.

    Cited By

    View all
    • (2024)The Long Way to Deforestation: A Type Inference and Elaboration Technique for Removing Intermediate Data StructuresProceedings of the ACM on Programming Languages10.1145/36746348:ICFP(249-283)Online publication date: 15-Aug-2024
    • (2024)From Batch to Stream: Automatic Generation of Online AlgorithmsProceedings of the ACM on Programming Languages10.1145/36564188:PLDI(1014-1039)Online publication date: 20-Jun-2024
    • (2024)Superfusion: Eliminating Intermediate Data Structures via Inductive SynthesisProceedings of the ACM on Programming Languages10.1145/36564158:PLDI(939-964)Online publication date: 20-Jun-2024
    • Show More Cited By

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    ICFP '07: Proceedings of the 12th ACM SIGPLAN international conference on Functional programming
    October 2007
    346 pages
    ISBN:9781595938152
    DOI:10.1145/1291151
    • cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 42, Issue 9
      Proceedings of the ICFP '07 conference
      September 2007
      331 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1291220
      Issue’s Table of Contents
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 01 October 2007

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. deforestation
    2. functional programming
    3. program fusion
    4. program optimisation
    5. program transformation

    Qualifiers

    • Article

    Conference

    ICFP07
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 333 of 1,064 submissions, 31%

    Upcoming Conference

    ICFP '24

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)67
    • Downloads (Last 6 weeks)6
    Reflects downloads up to 10 Aug 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)The Long Way to Deforestation: A Type Inference and Elaboration Technique for Removing Intermediate Data StructuresProceedings of the ACM on Programming Languages10.1145/36746348:ICFP(249-283)Online publication date: 15-Aug-2024
    • (2024)From Batch to Stream: Automatic Generation of Online AlgorithmsProceedings of the ACM on Programming Languages10.1145/36564188:PLDI(1014-1039)Online publication date: 20-Jun-2024
    • (2024)Superfusion: Eliminating Intermediate Data Structures via Inductive SynthesisProceedings of the ACM on Programming Languages10.1145/36564158:PLDI(939-964)Online publication date: 20-Jun-2024
    • (2024)Orchard: Heterogeneous Parallelism and Fine-grained Fusion for Complex Tree TraversalsACM Transactions on Architecture and Code Optimization10.1145/365260521:2(1-25)Online publication date: 21-May-2024
    • (2023)This Is Driving Me Loopy: Efficient Loops in Arrowized Functional Reactive ProgramsProceedings of the 16th ACM SIGPLAN International Haskell Symposium10.1145/3609026.3609726(3-17)Online publication date: 30-Aug-2023
    • (2023)flap: A Deterministic Parser with Fused LexingProceedings of the ACM on Programming Languages10.1145/35912697:PLDI(1194-1217)Online publication date: 6-Jun-2023
    • (2022)Composable Sequence Macros for Fast IterationProceedings of the 21st ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3564719.3568696(59-71)Online publication date: 29-Nov-2022
    • (2022)Staged compilation with two-level type theoryProceedings of the ACM on Programming Languages10.1145/35476416:ICFP(540-569)Online publication date: 31-Aug-2022
    • (2022)Functional collection programming with semi-ring dictionariesProceedings of the ACM on Programming Languages10.1145/35273336:OOPSLA1(1-33)Online publication date: 29-Apr-2022
    • (2022)Parallel block-delayed sequencesProceedings of the 27th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming10.1145/3503221.3508434(61-75)Online publication date: 2-Apr-2022
    • Show More Cited By

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media