paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Fine-grained, accurate and scalable source differencing

细粒度、准确且可扩展的源代码差分
ICSE Proceedings of the IEEE/ACM 46th International Conference on Software Engineering2024匹配度 2/10 · 论文关注 AST 源码差异比较与 GumTree 的可扩展性,属于软件工程/开发工具方向;与用户核心关注的 LLM/Agent 与静态分析、浮点程序分析、贝叶斯程序分析等交叉方向没有直接关联,仅作为 PL 与程序分析基础设施有微弱联系。引用 12 inbox
Jean-Remy Falleri, Matias Martinez
crossref: 2026-09-12

AI 速览

一句话:提出一种更廉价的启发式 AST 匹配方法,使 GumTree 可扩展到大型 AST,同时生成更小编辑脚本并显著加速。

理解代码变更对软件演化活动至关重要,但传统文本差分无法将变更对齐到源代码语法。结构差分(如 GumTree)通过 AST 匹配解决该问题,却依赖最优但昂贵的树编辑距离算法,难以处理大型 AST。本文提出一种开销更低的启发式匹配方法,使 GumTree 可扩展到大型 AST,并生成质量优于原算法的结果。作者在两种语言的 4 个变更数据集上评估,结果显示生成的 edit-script 中位大小缩小 50%,匹配时间总加速比达到 50 倍至 281 倍。

问题
传统文本差分无法按源代码语法对齐变更;已有结构差分工具 GumTree 的核心算法使用昂贵的最优树编辑距离,难以扩展到大型 AST。
方法
提出一种更廉价的启发式 AST 匹配与编辑脚本生成方法,替代或改进原算法中的最优树编辑距离以提升可扩展性。
评估
在两种语言的 4 个变更数据集上比较,编辑脚本中位大小缩小 50%,匹配时间加速 50x–281x。
原文摘要(Abstract)

Understanding code changes is of crucial importance in a wide range of software evolution activities. The traditional approach is to use textual differencing, as done with success since the 1970s with the ubiquitous diff tool. However, textual differencing has the important limitation of not aligning the changes to the syntax of the source code. To overcome these issues, structural (i.e. syntactic) differencing has been proposed in the literature, notably GumTree which was one of the pioneering approaches. The main drawback of GumTree's algorithm is the use of an optimal, but expensive tree-edit distance algorithm that makes it difficult to diff large ASTs. In this article, we describe a less expensive heuristic that enables GumTree to scale to large ASTs while yielding results of better quality than the original GumTree. We validate this new heuristic against 4 datasets of changes in two different languages, where we generate edit-scripts with a median size 50% smaller and a total speedup of the matching time between 50x and 281x.

链接与引用

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

BibTeX
@inproceedings{paperbot11303,
  title = {Fine-grained, accurate and scalable source differencing},
  author = {Jean-Remy Falleri and Matias Martinez},
  booktitle = {ICSE},
  year = {2024},
  doi = {10.1145/3597503.3639148}
}