4.6 Article

DiffSearch: A Scalable and Precise Search Engine for Code Changes

期刊

IEEE TRANSACTIONS ON SOFTWARE ENGINEERING
卷 49, 期 4, 页码 2366-2380

出版社

IEEE COMPUTER SOC
DOI: 10.1109/TSE.2022.3218859

关键词

Codes; Database languages; Search problems; Java; Python; Indexing; Feature extraction; Software engineering; program analysis; software maintenance

向作者/读者索取更多资源

This paper introduces DiffSearch, a search engine that returns a set of code changes matching a given query, using a query language with wildcards and placeholders and a tree-based matching algorithm. The approach indexes and maps code changes into a feature space for efficient searching. The implementation for Java, JavaScript, and Python responds within seconds, achieving high recall rates and outperforming regular expression-based and GitHub searches. The approach is valuable for finding relevant code changes and gathering real-world bug fix datasets.
The source code of successful projects is evolving all the time, resulting in hundreds of thousands of code changes stored in source code repositories. This wealth of data can be useful, e.g., to find changes similar to a planned code change or examples of recurring code improvements. This paper presents DiffSearch, a search engine that, given a query that describes a code change, returns a set of changes that match the query. The approach is enabled by three key contributions. First, we present a query language that extends the underlying programming language with wildcards and placeholders, providing an intuitive way of formulating queries that is easy to adapt to different programming languages. Second, to ensure scalability, the approach indexes code changes in a one-time preprocessing step, mapping them into a feature space, and then performs an efficient search in the feature space for each query. Third, to guarantee precision, i.e., that any returned code change indeed matches the given query, we present a tree-based matching algorithm that checks whether a query can be expanded to a concrete code change. We present implementations for Java, JavaScript, and Python, and show that the approach responds within seconds to queries across one million code changes, has a recall of 80.7% for Java, 89.6% for Python, and 90.4% for JavaScript, enables users to find relevant code changes more effectively than a regular expression-based search and GitHub's search feature, and is helpful for gathering a large-scale dataset of real-world bug fixes.

作者

我是这篇论文的作者
点击您的名字以认领此论文并将其添加到您的个人资料中。

评论

主要评分

4.6
评分不足

次要评分

新颖性
-
重要性
-
科学严谨性
-
评价这篇论文

推荐

暂无数据
暂无数据