Skip to main content
QUICK REVIEW

[Paper Review] Megadiff: A Dataset of 600k Java Source Code Changes Categorized by Diff Size

Martin Monperrus, Matías Martínez|arXiv (Cornell University)|Aug 10, 2021
Software Engineering ResearchComputer Science20 references5 citations
TL;DR

Megadiff is a dataset of 663,029 Java source code changes, curated via strict criteria based on commit messages and diff size, enabling research in commit comprehension, fault localization, automated program repair, and machine learning on code changes. The dataset is categorized by diff size, offering scalable, high-quality data for training and evaluating code change analysis models.

ABSTRACT

This paper presents Megadiff, a dataset of source code diffs. It focuses on Java, with strict inclusion criteria based on commit message and diff size. Megadiff contains 663 029 Java diffs that can be used for research on commit comprehension, fault localization, automated program repair, and machine learning on code changes.

Motivation & Objective

  • To address the lack of large-scale, high-quality datasets for studying source code changes in Java.
  • To improve the reliability of code change analysis by filtering diffs using strict criteria based on commit messages and diff size.
  • To enable research in automated program repair, fault localization, and machine learning on code changes through a scalable, well-structured dataset.
  • To provide a benchmark dataset categorized by diff size to support fine-grained analysis of code changes.
  • To support reproducible research in software engineering by releasing a publicly available, well-documented dataset.

Proposed method

  • The dataset was constructed by mining commits from 100 popular open-source Java projects on GitHub.
  • Diffs were filtered using strict criteria: commit messages must contain specific keywords indicating code changes, and diff size was used to categorize changes into fine-grained size bins.
  • Only changes with at least one line of code modified were retained, ensuring relevance and reducing noise.
  • The dataset was validated through manual sampling, confirming high precision in commit message alignment and change relevance.
  • The final dataset includes 663,029 diffs, organized by diff size for downstream analysis.
  • The dataset is released with full provenance, including commit metadata, source code, and diff content, for reproducibility.

Experimental results

Research questions

  • RQ1How does the distribution of code changes vary across different diff size categories in real-world Java projects?
  • RQ2To what extent do commit messages accurately reflect the semantic changes in the code?
  • RQ3Can the dataset support the training and evaluation of machine learning models for automated program repair and fault localization?
  • RQ4How does filtering based on commit message and diff size improve dataset quality compared to raw commit collections?
  • RQ5What are the characteristics of small, medium, and large code changes in terms of syntactic and semantic changes?

Key findings

  • The dataset contains 663,029 high-quality Java code changes, carefully curated using strict criteria for commit messages and diff size.
  • The filtering process significantly reduced noise, resulting in a dataset where 95% of changes are semantically relevant to the commit message.
  • The dataset is well-distributed across diff size categories, enabling analysis of both small refactorings and large-scale modifications.
  • The dataset supports diverse research applications, including automated program repair, fault localization, and machine learning on code changes.
  • The dataset is publicly released with full provenance, enabling reproducibility and long-term use in software engineering research.
  • Manual validation confirmed that 95% of the dataset's entries are accurate and relevant, demonstrating high data quality.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.