Optimistic evaluation: an adaptive evaluation strategy for non-strict programs
Optimistic evaluation: an adaptive evaluation strategy for non-strict programs
复制标题
乐观评估:非严格程序的自适应评估策略
DOI:
--
复制
发表时间:
2003
期刊:
影响因子:
--
通讯作者:
S. Jones
中科院分区:
文献类型:
--
作者:
Robert Ennals;S. Jones
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.