Project Dates: 
January 2017

This project is supported by DARPA Award FA8750-16-2-0286, “Software Analytics for Big Code.”

Project Description: 

Previous studies have shown that there is a non-trivial amount of duplication in source code. We analyzed a corpus of 2.6 million non-fork projects hosted on GitHub representing over 258 million files written in Java, C++ Python and JavaScript. We found that this corpus has a mere 54 million unique files. In other words, 79% of the code on GitHub consists of clones of previously created files. There is considerable variation between language ecosystems. JavaScript has the highest rate of file duplication, only 7% of the files are distinct. Java, on the other hand, has the least duplication, 65% of files are distinct. Focusing on files that have some differences, we found between 31% and 43% of files with strong similarities. Lastly, we made a project-level analysis, and found that between 10% and 20% of the projects contain at least 80% of files that can be found elsewhere. These surprisingly high rates of duplication have implications for systems built on open source software as well as for researchers interested in analyzing large code bases. As a concrete artifact of this study, we have created DéjàVu, a publicly available map of code duplicates in GitHub repositories.

This work was featured on the Dept. of Informatics website in October 2017.

Lopes, C., P. Maj, P. Martins, V. Saini, D. Yang, J. Zitny, H. Sajnani, and J. Vitek, "DéjàVu: A Map of Code Duplicates on GitHub", SPLASH 2017 - OOPSLA. Proceedings of the ACM on Programming Languages (PACMPL), Vancouver, Canada, ACM, pp. Article 84; 28 pages, October, 2017.