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.
- V. Balat. Ocsigen: typing Web interaction with Objective Caml. In Proc. ML Workshop, 2006. Google Scholar
Digital Library
- V. Balat, J. Vouillon, and B. Yakobowski. Experience report: Ocsigen, a Web programming framework. In Proc. ICFP, pages 311–316. ACM, 2009. Google Scholar
Digital Library
- H. Cejtin, S. Jagannathan, and S. Weeks. Flow-directed closure conversion for typed languages. In Proc. ESOP, pages 56–71. Springer-Verlag, 2000. Google Scholar
Digital Library
- J. Cheney, S. Lindley, and P. Wadler. A practical theory of languageintegrated query. In Proc. ICFP, pages 403–416. ACM, 2013. Google Scholar
Digital Library
- A. Chlipala. Ur: Statically-typed metaprogramming with type-level record computation. In Proc. PLDI, pages 122–133. ACM, 2010. Google Scholar
Digital Library
- A. Chlipala. Ur/Web: A simple model for programming the Web. In Proc. POPL, pages 153–165. ACM, 2015. Google Scholar
Digital Library
- E. Cooper, S. Lindley, P. Wadler, and J. Yallop. Links: Web programming without tiers. In Proc. FMCO, pages 266–296, 2006. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- S. Ducasse, A. Lienhard, and L. Renggli. Seaside – a multiple control flow Web application framework. In European Smalltalk User Group – Research Track, 2004.Google Scholar
- C. Elliott and P. Hudak. Functional reactive animation. In Proc. ICFP, pages 263–273, 1997. Google Scholar
Digital Library
- M. Elsman and N. Hallenberg. Web programming with SMLserver. In Proc. PADL, pages 74–91. Springer-Verlag, January 2003. Google Scholar
Digital Library
- M. Fluet and S. Weeks. Contification using dominators. In Proc. ICFP, pages 2–13. ACM, 2001. Google Scholar
Digital Library
- J. Garrigue. Code reuse through polymorphic variants. In Proc. Workshop on Foundations of Software Engineering, 2000.Google Scholar
- 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. Google Scholar
Digital Library
- F. Loitsch and M. Serrano. Hop client-side compilation. In Proc. TFL, 2007.Google Scholar
- D. MacQueen. Modules for Standard ML. In Proc. LFP, pages 198– 207. ACM, 1984. Google Scholar
Digital Library
- S. Peyton Jones. Call-pattern specialisation for Haskell programs. In Proc. ICFP, pages 327–337. ACM, 2007. Google Scholar
Digital Library
- S. L. Peyton Jones and D. Lester. A modular fully-lazy lambda lifter in Haskell. Softw. Pract. Exper., 21(5):479–506, May 1991. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- S. L. Peyton Jones and P. Wadler. Imperative functional programming. In Proc. POPL, pages 71–84. ACM, 1993. Google Scholar
Digital Library
- B. C. Pierce. Higher-order polymorphism. In Types and Programming Languages, chapter 30. MIT Press, 2002.Google Scholar
- J. C. Reynolds. Types, abstraction and parametric polymorphism. In IFIP Congress, pages 513–523, 1983.Google Scholar
- M. Serrano. Hop, a fast server for the diffuse web. In Proc. COORDINATION, pages 1–26. Springer-Verlag, 2009. Google Scholar
Digital Library
- M. Serrano, E. Gallesio, and F. Loitsch. Hop, a language for programming the Web 2.0. In Proc. DLS, 2006.Google Scholar
- M. Tofte and J.-P. Talpin. Region-based memory management. Inf. Comput., 132(2):109–176, Feb. 1997. Google Scholar
Digital Library
- P. Wadler. Deforestation: Transforming programs to eliminate trees. In Proc. ESOP, pages 344–358. Springer-Verlag, 1988. Google Scholar
Digital Library
- P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad hoc. In Proc. POPL, pages 60–76. ACM, 1989. Google Scholar
Digital Library
- M. Wand. Type inference for record concatenation and multiple inheritance. Information and Computation, 93(1), 1991. Google Scholar
Digital Library
- S. Weeks. Whole-program compilation in MLton. In Proc. ML Workshop, pages 1–1. ACM, 2006. Google Scholar
Digital Library
- L. Ziarek, S. Weeks, and S. Jagannathan. Flattening tuples in an SSA intermediate representation. Higher Order Symbol. Comput., 21(3): 333–358, Sept. 2008. Google Scholar
Digital Library
Index Terms
An optimizing compiler for a purely functional web-application language
Recommendations
An optimizing compiler for a purely functional web-application language
ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional ProgrammingHigh-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 ...
Functional language compiler experiences at Intel
CUFP '10: ACM SIGPLAN Commercial Users of Functional ProgrammingFor five years Intel's Programming Systems Lab (PSL) has been collaborating with an external partner on a new functional programming language designed for productivity on many-core processors. While the language is not yet public, this talk outlines ...
Compiler algorithm language (CAL): an interpreter and compiler
ACST'07: Proceedings of the third conference on IASTED International Conference: Advances in Computer Science and TechnologyWe have designed a Compiler Algorithm Language (CAL) to provide compiler writers with a language which is close to actual algorithmic notation. In this work, we have developed an interpreter and debugger for CAL which can be used by researchers for ...






Comments