skip to main content
10.1145/2784731.2784741acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

An optimizing compiler for a purely functional web-application language

Published: 29 August 2015 Publication History

Abstract

High-level scripting languages have become tremendously popular for development of dynamic Web applications. Many programmers appreciate the productivity benefits of automatic storage management, freedom from verbose type annotations, and so on. While it is often possible to improve performance substantially by rewriting an application in C or a similar language, very few programmers bother to do so, because of the consequences for human development effort. This paper describes a compiler that makes it possible to have most of the best of both worlds, coding Web applications in a high-level language but compiling to native code with performance comparable to handwritten C code. The source language is Ur/Web, a domain-specific, purely functional, statically typed language for the Web. Through a coordinated suite of relatively straightforward program analyses and algebraic optimizations, we transform Ur/Web programs into almost-idiomatic C code, with no garbage collection, little unnecessary memory allocation for intermediate values, etc. Our compiler is in production use for commercial Web sites supporting thousands of users, and microbenchmarks demonstrate very competitive performance versus mainstream tools.

References

[1]
V. Balat. Ocsigen: typing Web interaction with Objective Caml. In Proc. ML Workshop, 2006.
[2]
V. Balat, J. Vouillon, and B. Yakobowski. Experience report: Ocsigen, a Web programming framework. In Proc. ICFP, pages 311–316. ACM, 2009.
[3]
H. Cejtin, S. Jagannathan, and S. Weeks. Flow-directed closure conversion for typed languages. In Proc. ESOP, pages 56–71. Springer-Verlag, 2000.
[4]
J. Cheney, S. Lindley, and P. Wadler. A practical theory of languageintegrated query. In Proc. ICFP, pages 403–416. ACM, 2013.
[5]
A. Chlipala. Ur: Statically-typed metaprogramming with type-level record computation. In Proc. PLDI, pages 122–133. ACM, 2010.
[6]
A. Chlipala. Ur/Web: A simple model for programming the Web. In Proc. POPL, pages 153–165. ACM, 2015.
[7]
E. Cooper, S. Lindley, P. Wadler, and J. Yallop. Links: Web programming without tiers. In Proc. FMCO, pages 266–296, 2006.
[8]
D. Coutts, R. Leshchinskiy, and D. Stewart. Stream fusion: From lists to streams to nothing at all. In Proc. ICFP, pages 315–326. ACM, 2007.
[9]
S. Ducasse, A. Lienhard, and L. Renggli. Seaside – a multiple control flow Web application framework. In European Smalltalk User Group – Research Track, 2004.
[10]
C. Elliott and P. Hudak. Functional reactive animation. In Proc. ICFP, pages 263–273, 1997.
[11]
M. Elsman and N. Hallenberg. Web programming with SMLserver. In Proc. PADL, pages 74–91. Springer-Verlag, January 2003.
[12]
M. Fluet and S. Weeks. Contification using dominators. In Proc. ICFP, pages 2–13. ACM, 2001.
[13]
J. Garrigue. Code reuse through polymorphic variants. In Proc. Workshop on Foundations of Software Engineering, 2000.
[14]
S. Krishnamurthi, P. W. Hopkins, J. McCarthy, P. T. Graunke, G. Pettyjohn, and M. Felleisen. Implementation and use of the PLT Scheme Web Server. Higher Order Symbol. Comput., 20(4):431–460, 2007.
[15]
F. Loitsch and M. Serrano. Hop client-side compilation. In Proc. TFL, 2007.
[16]
D. MacQueen. Modules for Standard ML. In Proc. LFP, pages 198– 207. ACM, 1984.
[17]
S. Peyton Jones. Call-pattern specialisation for Haskell programs. In Proc. ICFP, pages 327–337. ACM, 2007.
[18]
S. L. Peyton Jones and D. Lester. A modular fully-lazy lambda lifter in Haskell. Softw. Pract. Exper., 21(5):479–506, May 1991.
[19]
S. L. Peyton Jones and A. L. M. Santos. A transformation-based optimiser for Haskell. Sci. Comput. Program., 32(1-3):3–47, Sept. 1998.
[20]
S. L. Peyton Jones and P. Wadler. Imperative functional programming. In Proc. POPL, pages 71–84. ACM, 1993.
[21]
B. C. Pierce. Higher-order polymorphism. In Types and Programming Languages, chapter 30. MIT Press, 2002.
[22]
J. C. Reynolds. Types, abstraction and parametric polymorphism. In IFIP Congress, pages 513–523, 1983.
[23]
M. Serrano. Hop, a fast server for the diffuse web. In Proc. COORDINATION, pages 1–26. Springer-Verlag, 2009.
[24]
M. Serrano, E. Gallesio, and F. Loitsch. Hop, a language for programming the Web 2.0. In Proc. DLS, 2006.
[25]
M. Tofte and J.-P. Talpin. Region-based memory management. Inf. Comput., 132(2):109–176, Feb. 1997.
[26]
P. Wadler. Deforestation: Transforming programs to eliminate trees. In Proc. ESOP, pages 344–358. Springer-Verlag, 1988.
[27]
P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad hoc. In Proc. POPL, pages 60–76. ACM, 1989.
[28]
M. Wand. Type inference for record concatenation and multiple inheritance. Information and Computation, 93(1), 1991.
[29]
S. Weeks. Whole-program compilation in MLton. In Proc. ML Workshop, pages 1–1. ACM, 2006.
[30]
L. Ziarek, S. Weeks, and S. Jagannathan. Flattening tuples in an SSA intermediate representation. Higher Order Symbol. Comput., 21(3): 333–358, Sept. 2008.

Cited By

View all
  • (2023)Generic Programming with Extensible Data Types: Or, Making Ad Hoc Extensible Data Types Less Ad HocProceedings of the ACM on Programming Languages10.1145/36078437:ICFP(356-384)Online publication date: 31-Aug-2023
  • (2021)A Typed Slicing Compilation of the Polymorphic RPC calculusProceedings of the 23rd International Symposium on Principles and Practice of Declarative Programming10.1145/3479394.3479406(1-15)Online publication date: 6-Sep-2021
  • (2021)Efficient tree-traversals: reconciling parallelism and dense data representationsProceedings of the ACM on Programming Languages10.1145/34735965:ICFP(1-29)Online publication date: 19-Aug-2021
  • Show More Cited By

Index Terms

  1. An optimizing compiler for a purely functional web-application language

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Conferences
      ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming
      August 2015
      436 pages
      ISBN:9781450336697
      DOI:10.1145/2784731
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 50, Issue 9
        ICFP '15
        September 2015
        436 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2858949
        • Editor:
        • Andy Gill
        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 the author(s) 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: 29 August 2015

      Permissions

      Request permissions for this article.

      Check for updates

      Author Tags

      1. Web programming languages
      2. pure functional programming
      3. whole-program optimization

      Qualifiers

      • Research-article

      Conference

      ICFP'15
      Sponsor:

      Acceptance Rates

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

      Upcoming Conference

      ICFP '25
      ACM SIGPLAN International Conference on Functional Programming
      October 12 - 18, 2025
      Singapore , Singapore

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)4
      • Downloads (Last 6 weeks)1
      Reflects downloads up to 13 Dec 2024

      Other Metrics

      Citations

      Cited By

      View all
      • (2023)Generic Programming with Extensible Data Types: Or, Making Ad Hoc Extensible Data Types Less Ad HocProceedings of the ACM on Programming Languages10.1145/36078437:ICFP(356-384)Online publication date: 31-Aug-2023
      • (2021)A Typed Slicing Compilation of the Polymorphic RPC calculusProceedings of the 23rd International Symposium on Principles and Practice of Declarative Programming10.1145/3479394.3479406(1-15)Online publication date: 6-Sep-2021
      • (2021)Efficient tree-traversals: reconciling parallelism and dense data representationsProceedings of the ACM on Programming Languages10.1145/34735965:ICFP(1-29)Online publication date: 19-Aug-2021
      • (2021)Towards Scalable Security of Real-time Applications: A Formally Certified Approach2021 26th IEEE International Conference on Emerging Technologies and Factory Automation (ETFA )10.1109/ETFA45728.2021.9613489(01-04)Online publication date: 7-Sep-2021
      • (2021)Cogent: uniqueness types and certifying compilationJournal of Functional Programming10.1017/S095679682100023X31Online publication date: 27-Oct-2021
      • (2019)Payload fragmentation framework for high-performance computing in cloud environmentThe Journal of Supercomputing10.1007/s11227-018-2660-775:5(2789-2804)Online publication date: 1-May-2019
      • (2018)MIL, a Monadic Intermediate Language for Implementing Functional LanguagesProceedings of the 30th Symposium on Implementation and Application of Functional Languages10.1145/3310232.3310238(71-82)Online publication date: 5-Sep-2018
      • (2018)Tierless Web Programming in the LargeCompanion Proceedings of the The Web Conference 201810.1145/3184558.3185953(681-689)Online publication date: 23-Apr-2018
      • (2016)EliomProceedings of the 28th Symposium on the Implementation and Application of Functional Programming Languages10.1145/3064899.3064901(1-12)Online publication date: 31-Aug-2016
      • (2016)Refinement through restraint: bringing down the cost of verificationACM SIGPLAN Notices10.1145/3022670.295194051:9(89-102)Online publication date: 4-Sep-2016
      • Show More Cited By

      View Options

      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