Asymptotic speedup via effect handlers

IF 1.1 3区 计算机科学 Q4 COMPUTER SCIENCE, SOFTWARE ENGINEERING
DANIEL HILLERSTRÖM, SAM LINDLEY, JOHN LONGLEY
{"title":"Asymptotic speedup via effect handlers","authors":"DANIEL HILLERSTRÖM, SAM LINDLEY, JOHN LONGLEY","doi":"10.1017/s0956796824000030","DOIUrl":null,"url":null,"abstract":"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 <jats:italic>generic count</jats:italic> problem in the context of a pure functional base language <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796824000030_inline1.png\" /> <jats:tex-math> ${\\lambda_{\\textrm{b}}}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> and an extension <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796824000030_inline2.png\" /> <jats:tex-math> ${\\lambda_{\\textrm{h}}}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> with general <jats:italic>effect handlers</jats:italic>. We prove that <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796824000030_inline3.png\" /> <jats:tex-math> ${\\lambda_{\\textrm{h}}}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> admits an asymptotically more efficient implementation of generic count than any implementation in <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796824000030_inline4.png\" /> <jats:tex-math> ${\\lambda_{\\textrm{b}}}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>. We also show that this gap remains even when <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796824000030_inline5.png\" /> <jats:tex-math> ${\\lambda_{\\textrm{b}}}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> is extended to a language <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796824000030_inline6.png\" /> <jats:tex-math> ${{{{{{\\lambda_{\\textrm{a}}}}}}}}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> with <jats:italic>affine effect handlers</jats:italic>, 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.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1000,"publicationDate":"2024-04-05","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Functional Programming","FirstCategoryId":"94","ListUrlMain":"https://doi.org/10.1017/s0956796824000030","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q4","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

Abstract

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}}}}}}}}$,这种语言的强度足以编码异常、局部状态、例行程序和单次连续,这种差距依然存在。这就找到了 "单发 "和 "多发 "版本的分隔控制之间的效率差异。据我们所知,这些结果是首次针对控制运算符得出的。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
Journal of Functional Programming
Journal of Functional Programming 工程技术-计算机:软件工程
CiteScore
1.70
自引率
0.00%
发文量
9
审稿时长
>12 weeks
期刊介绍: Journal of Functional Programming is the only journal devoted solely to the design, implementation, and application of functional programming languages, spanning the range from mathematical theory to industrial practice. Topics covered include functional languages and extensions, implementation techniques, reasoning and proof, program transformation and synthesis, type systems, type theory, language-based security, memory management, parallelism and applications. The journal is of interest to computer scientists, software engineers, programming language researchers and mathematicians interested in the logical foundations of programming.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信