paperbot · PL 论文追踪

全部论文 待读 收藏

P2 SlipCover: Near Zero-Overhead Code Coverage for Python

SlipCover:面向 Python 的近零开销代码覆盖率分析
ISSTA Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis2023匹配度 3/10 · 该论文关注 Python 运行时覆盖率工具,使用 AST 与字节码动态插桩来降低开销,属于软件工程/动态程序分析方向;但它与用户核心方向(面向 ML/Agentic 程序的静态分析、LLM 辅助形式化验证、浮点程序分析、贝叶斯程序分析)没有直接交叉,也未涉及 LLM/Agent、浮点或贝叶斯方法。引用 12 inbox
Juan Altmayer Pizzorno, Emery D. Berger
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:SlipCover 通过 AST 识别与字节码动态插桩/去插桩,将 Python 覆盖率开销降至中位数 5%。

覆盖率分析常因高开销而受限,Python 中尤为严重:标准解释器下 coverage.py 中位开销 180%,PyPy 下高达 1300%,限制了测试、模糊测试和部署场景。SlipCover 无需修改 Python 解释器或 PyPy:先分析 AST 精确识别分支与行,再动态重写字节码,为每个分支和行加入轻量插桩;运行时周期性移除已覆盖的行和分支的插桩。评估显示其开销中位数仅 5%,可用于部署。作者还将 SlipCover 集成到定向属性测试系统 TPBT,获得 22 倍加速。

问题
Python 覆盖率分析开销过高,coverage.py 在 CPython/PyPy 下造成显著减速,阻碍其在测试、fuzzing 与部署中的使用。
方法
SlipCover 先基于 AST 精确识别分支和行,再动态重写字节码进行轻量插桩,并在运行时周期性对已覆盖位置去插桩。
评估
在 Python/PyPy 上测量中位开销仅 5%;集成到 TPBT 属性测试系统后实现 22 倍加速。
原文摘要(Abstract)

Coverage analysis is widely used but can suffer from high overhead. This overhead is especially acute in the context of Python, which is already notoriously slow (a recent study observes a roughly 30x slowdown vs. native code). We find that the state-of-the-art coverage tool for Python, coverage.py, introduces a median overhead of 180% with the standard Python interpreter. Slowdowns are even more extreme when using PyPy, a JIT-compiled Python implementation, with coverage.py imposing a median overhead of 1,300%. This performance degradation reduces the utility of coverage analysis in most use cases, including testing and fuzzing, and precludes its use in deployment. This paper presents SlipCover, a novel, near-zero overhead coverage analyzer for Python. SlipCover works without modifications to either the Python interpreter or PyPy. It first processes a program's AST to accurately identify all branches and lines. SlipCover then dynamically rewrites Python bytecodes to add lightweight instrumentation to each identified branch and line. At run time, SlipCover periodically de-instruments already-covered lines and branches. The result is extremely low overheads -- a median of just 5% -- making SlipCover suitable for use in deployment. We show its efficiency can translate to significant increases in the speed of coverage-based clients. As a proof of concept, we integrate SlipCover into TPBT, a targeted property-based testing system, and observe a 22x speedup.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{abs-2305-02886,
  title = {SlipCover: Near Zero-Overhead Code Coverage for Python},
  author = {Juan Altmayer Pizzorno and Emery D. Berger},
  booktitle = {ISSTA},
  year = {2023},
  doi = {10.1145/3597926.3598128}
}