arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.04218cs.PL
收藏

在具有效果的多型算法中简化显式子类型转换

Simplifying explicit subtyping coercions in a polymorphic calculus with effects

University of Ljubljana, Faculty of Mathematics and Physics(卢布尔雅那大学数学与物理学院);Institute of Mathematics, Physics and Mechanics(数学、物理与力学研究所)

Filip Koprivec, Matija Pretnar

AI总结:

本文提出了一种多型效果算法,通过简化显式子类型转换来减少编译开销,实验表明该方法能显著提升代码效率。

摘要:

代数效果处理器正变得越来越流行,用于结构化具有效果的计算,但其性能常常成为关注点。一种提出的方法是通过显式子类型转换来跟踪效果信息以实现高效编译。然而,在多型存在的情况下,这些转换会被编译成额外的函数参数,导致显著的开销。在本文中,我们提出了一种多型效果算法,确定了需要简化以减少不必要的约束的阶段,并证明这些简化保持语义。此外,我们在Eff语言中实现了简化算法,并在多个基准上评估了其性能。尽管我们没有证明所呈现的简化的最优性,但结果表明该算法消除了所有转换,使代码效率与手动单型化代码一样高效。

英文摘要:

Algebraic effect handlers are becoming an increasingly popular way of structuring effectful computations, and their performance is often a concern. One of the proposed approaches towards efficient compilation is tracking effect information through explicit subtyping coercions. However, in the presence of polymorphism, these coercions are compiled into additional arguments of compiled functions, incurring significant overhead. In this paper, we present a polymorphic effectful calculus, identify simplification phases needed to reduce the number of unnecessary constraints, and prove that they preserve semantics. In addition, we implement the simplification algorithm in the Eff language and evaluate its performance on a number of benchmarks. Though we do not prove the optimality of the presented simplifications, the results show that the algorithm eliminates all coercions, resulting in code as efficient as manually monomorphised one.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑