一句话:首次评估面向效应处理器的追踪 JIT 编译,将 Eff、Effekt、Koka 编译到统一字节码并基于 RPython 实现,分析性能与优化效果。
效应处理器(effect handlers)支持非局部但结构化的控制流,可统一生成器、异常、异步等特性,但现有高效实现往往牺牲部分语言特性。追踪 JIT 通过解释器记录执行轨迹、动态识别热点循环并利用运行时信息激进优化,尤其擅长优化动态控制流,而这正是效应处理器所引入的。本文首次专门评估面向效应处理器的追踪 JIT 编译:作者将 Eff、Effekt、Koka 编译到统一的字节码格式,并基于 RPython 实现追踪 JIT,评估其性能,讨论哪些类型的效应程序能被良好优化以及新增优化对性能的影响,并与主流语言实现基线进行对比。
Effect handlers are a programming language feature that has recently gained popularity. They allow for nonlocal yet structured control flow and subsume features like generators, exceptions, asynchronicity, etc. However, implementations of effect handlers currently often sacrifice features to enable efficient implementations. Meta-tracing just-in-time (JIT) compilers promise to yield the performance of a compiler by implementing an interpreter. They record execution in a trace, dynamically detect hot loops, and aggressively optimize those using information available at runtime. They excel at optimizing dynamic control flow, which is exactly what effect handlers introduce. We present the first evaluation of tracing JIT compilation specifically for effect handlers. To this end, we developed RPython-based tracing JIT implementations for Eff, Effekt, and Koka by compiling them to a common bytecode format. We evaluate the performance, discuss which classes of effectful programs are optimized well and how our additional optimizations influence performance. We also benchmark against a baseline of state-of-the-art mainstream language implementations.
@article{paperbot3010,
title = {Tracing Just-in-Time Compilation for Effects and Handlers},
author = {Marcial Gaißert and CF Bolz-Tereick and Jonathan Immanuel Brachthäuser},
journal = {Proceedings of the ACM on Programming Languages},
volume = {9},
number = {OOPSLA2},
year = {2025},
doi = {10.1145/3763085}
}