HyperDiff: Computing Source Code Diffs at Scale
Quentin Le Dilavrec, Djamel Eddine Khelladi, Arnaud Blouin, Jean-Marc Jézéquel
Abstract
With the advent of fast software evolution and multistage releases, temporal code analysis is becoming useful for various purposes, such as bug cause identification, bug prediction or code evolution analysis. Temporal code analyses can consist in analyzing multiple Abstract Syntax Trees (ASTs) extracted from code evolutions, e.g. one AST for each commit or release. Core feature to temporal analysis is code differencing: the computation of the so-called Diff or edit script between two given versions of the code. However, jointly analyzing and computing the difference on thousands versions of code faces scalability issues. Mainly because of the cost of: 1) parsing the original and evolved code in two source and target ASTs; 2) wasting resources by not reusing intermediate computation results that can be shared between versions. This paper details a novel approach based on time-oriented data structures that makes code differencing scale up to large software codebases. In particular, we leverage on the HyperAST, a novel representation of code histories, to propose an incremental and memory efficient approach by lazifying the well known GumTree diffing algorithms, a mainstream code differencing algorithm and tool. We evaluated our approach on a curated list of 19 large software projects and compared it to GumTree. Our approach outperforms it in scalability both in time and memory. We observed an order-of-magnitude difference: 1) in CPU time from x1.2 to x12.7 for the total time of diff computation and up to x226 in intermediate phases of the diff computation, and 2) in memory footprint of x4.5 per AST node. The approach produced 99.3% of identical diffs with respect to GumTree.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 9e377fb2-959b-44a0-a9aa-de0c18237910Cited by top-tier papers1
Ask how each one uses itBuilds on3
- CodeShovel: Constructing Method-Level Source Code HistoriesFelix Grund, Shaiful Alam Chowdhury, Nick C. Bradley, Braxton Hall et al.ICSE 2021 · 33 citations
- Accurate method and variable tracking in commit historyMehran Jodavi, Nikolaos TsantalisFSE 2022 · 12 citations
- HyperAST: Enabling Efficient Analysis of Software Histories at ScaleQuentin Le Dilavrec, Djamel Eddine Khelladi, Arnaud Blouin, Jean-Marc JézéquelASE 2022 · 5 citations
Related papers
- Fine-grained, accurate and scalable source differencingJean-Rémy Falleri, Matias MartinezICSE 2024 · 9 citations
- A Differential Testing Approach for Evaluating Abstract Syntax Tree Mapping AlgorithmsYuanrui Fan, Xin Xia, David Lo, Ahmed E. Hassan et al.ICSE 2021 · 18 citations
- iASTMapper: An Iterative Similarity-Based Abstract Syntax Tree Mapping AlgorithmNeng Zhang, Qinde Chen, Zibin Zheng, Ying ZouASE 2023 · 2 citations
- DIFFBASE: a differential factbase for effective software evolution managementXiuheng Wu, Chenguang Zhu, Yi LiFSE 2021 · 7 citations
- RAT: A Refactoring-Aware Traceability Model for Bug LocalizationFeifei Niu, Wesley K. G. Assunção, LiGuo Huang, Christoph Mayr-Dorn et al.ICSE 2023 · 16 citations
