一句话:评估现成性能分析器能否指导 Typed Racket 的逐组件混合类型迁移,并给出最有效的边界分析器驱动迁移策略。
程序从无类型到有类型的逐组件迁移可能引发意外性能退化:选对组件可降低类型强制成本,选错则加重。本文研究现成的 profiling 工具能否为 Typed Racket 中的迁移选择提供有效指导。作者采用理性程序员方法,在数万个性能调试场景上比较两种 profiler 与 23 种将 profiler 输出转化为迁移选择的策略。最有效策略依赖 boundary profiler 找代价最高的组件间边界,并在其两侧添加深度强制类型;当 profiler 未能识别边界时,策略随机迁移一步以避免停滞。结果表明,在至多容忍两次性能退化的前提下,该策略能在超过一半场景中完全消除运行时类型检查成本。
The component-by-component migration of a program from untyped to typed can trigger unintended performance degradations. When such a degradation occurs, typing well-chosen components can lessen the cost of type enforcement, while typing poorly chosen components can exacerbate it. This article examines whether off-the-shelf profiling tools deliver information that is an effective guide for navigating these migration choices in Typed Racket. Using the rational-programmer method, the article tests this hypothesis with an experiment that involves tens of thousands of performance-debugging scenarios, two different profiler types, and 23 strategies that convert profiler output to migration choices. The most effective strategy relies on a boundary profiler to identify the costliest inter-component boundary and then adds deeply enforced types to both sides. When the output of this profiler fails to identify a boundary, the strategy takes a random migration step—similar to the way many computational approaches resort temporarily to random choices to avoid getting stuck. The strategy completely eliminates the cost of run-time type checks in more than half of the scenarios if at most two performance degradations are tolerable along the way.
@article{HejdukGFD26,
title = {Navigating Mixed-Typed Migration with Profilers},
author = {Nathaniel Hejduk and Ben Greenman and Matthias Felleisen and Christos Dimoulas},
journal = {ACM Transactions on Programming Languages and Systems},
volume = {48},
number = {1},
year = {2026},
doi = {10.1145/3785004}
}