当前位置: X-MOL 学术J. Funct. Program. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Asymptotic speedup via effect handlers
Journal of Functional Programming ( IF 1.1 ) Pub Date : 2024-04-05 , DOI: 10.1017/s0956796824000030
DANIEL HILLERSTRÖM , SAM LINDLEY , JOHN LONGLEY

We study a fundamental efficiency benefit afforded by delimited control, showing that for certain higher-order functions, a language with advanced control features offers an asymptotic improvement in runtime over a language without them. Specifically, we consider the generic count problem in the context of a pure functional base language ${\lambda_{\textrm{b}}}$ and an extension ${\lambda_{\textrm{h}}}$ with general effect handlers. We prove that ${\lambda_{\textrm{h}}}$ admits an asymptotically more efficient implementation of generic count than any implementation in ${\lambda_{\textrm{b}}}$ . We also show that this gap remains even when ${\lambda_{\textrm{b}}}$ is extended to a language ${{{{{{\lambda_{\textrm{a}}}}}}}}$ with affine effect handlers, which is strong enough to encode exceptions, local state, coroutines and single-shot continuations. This locates the efficiency difference in the gap between ‘single-shot’ and ‘multi-shot’ versions of delimited control. To our knowledge, these results are the first of their kind for control operators.

中文翻译:

通过效果处理程序渐近加速

我们研究了定界控制带来的基本效率优势,结果表明,对于某些高阶函数,具有高级控制功能的语言比不具有高级控制功能的语言在运行时方面提供了渐进改进。具体来说,我们考虑通用计数纯函数式基础语言上下文中的问题 ${\lambda_{\textrm{b}}}$ 和一个扩展 ${\lambda_{\textrm{h}}}$ 与一般效果处理程序。我们证明 ${\lambda_{\textrm{h}}}$ 承认通用计数的实现比任何实现都渐近更有效 ${\lambda_{\textrm{b}}}$ 。我们还表明,即使当 ${\lambda_{\textrm{b}}}$ 被扩展到一种语言 ${{{{{\lambda_{\textrm{a}}}}}}}}$ 仿射效应处理程序,它足够强大,可以对异常、本地状态、协程和单次延续进行编码。这确定了定界控制的“单次”和“多次”版本之间的效率差异。据我们所知,这些结果对于控制操作员来说是首次。
更新日期:2024-04-05
down
wechat
bug