Asymptotic speedup via effect handlers
Guardado en:
| Publicado en: | Journal of Functional Programming vol. 34 (2024) |
|---|---|
| Autor principal: | |
| Otros Autores: | , |
| Publicado: |
Cambridge University Press
|
| Materias: | |
| Acceso en línea: | Citation/Abstract Full Text - PDF |
| Etiquetas: |
Sin Etiquetas, Sea el primero en etiquetar este registro!
|
| Resumen: | 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 <inline-formula><inline-graphic mime-subtype="png" xlink:href="S0956796824000030_inline1.png" />\({\lambda_{\textrm{b}}}\)</inline-formula> and an extension <inline-formula><inline-graphic mime-subtype="png" xlink:href="S0956796824000030_inline2.png" />\({\lambda_{\textrm{h}}}\)</inline-formula> with general effect handlers. We prove that <inline-formula><inline-graphic mime-subtype="png" xlink:href="S0956796824000030_inline3.png" />\({\lambda_{\textrm{h}}}\)</inline-formula> admits an asymptotically more efficient implementation of generic count than any implementation in <inline-formula><inline-graphic mime-subtype="png" xlink:href="S0956796824000030_inline4.png" />\({\lambda_{\textrm{b}}}\)</inline-formula>. We also show that this gap remains even when <inline-formula><inline-graphic mime-subtype="png" xlink:href="S0956796824000030_inline5.png" />\({\lambda_{\textrm{b}}}\)</inline-formula> is extended to a language <inline-formula><inline-graphic mime-subtype="png" xlink:href="S0956796824000030_inline6.png" />\({{{{{{\lambda_{\textrm{a}}}}}}}}\)</inline-formula> 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. |
|---|---|
| ISSN: | 0956-7968 1469-7653 |
| DOI: | 10.1017/S0956796824000030 |
| Fuente: | Advanced Technologies & Aerospace Database |