Affiliation:
1. University of Cambridge, Cambridge, UK
2. Microsoft Research Ltd, Cambridge, UK
Abstract
Lazy programs are beautiful, but they are slow because they build many thunks. Simple measurements show that most of these thunks are unnecessary: they are in fact always evaluated, or are always cheap. In this paper we describe Optimistic Evaluation --- an evaluation strategy that exploits this observation. Optimistic Evaluation complements compile-time analyses with run-time experiments: it evaluates a thunk speculatively, but has an abortion mechanism to back out if it makes a bad choice. A run-time adaption mechanism records expressions found to be unsuitable for speculative evaluation, and arranges for them to be evaluated more lazily in the future.We have implemented optimistic evaluation in the Glasgow Haskell Compiler. The results are encouraging: many programs speed up significantly (5-25%), some improve dramatically, and none go more than 15% slower.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
8 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Promises are made to be broken: migrating R to strict semantics;Proceedings of the ACM on Programming Languages;2021-10-20
2. An efficient thread partition policy for secure functional language;Journal of Computer Virology and Hacking Techniques;2014-12-30
3. Profiling for laziness;Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages;2014-01-08
4. Laziness by Need;Programming Languages and Systems;2013
5. Complete Laziness: a Natural Semantics;Electronic Notes in Theoretical Computer Science;2008-04