Software-Clone Rates in Open-Source Programs Written in C or C++
Rainer Koschke, Saman Bazrafshan · 2016
It is often claimed that duplicated code, also known as software clones, occurs frequently. Different researchers have reported clone rates in the range of 19 and 28%, in extreme cases even 59% for particular systems. It is not clear, however, whether those systems are just outliers. In this paper, we analyze about 7,800 open-source projects written in C or C++, summing up to 240 MSLOC, and measure their clone rates. We use statistical analysis to estimate the means of clone rates in open-source projects. Based on our findings, we could not confirm the high clone rates reported in previous studies as expected averages. Except for small projects including a few copied and modified files, we found rather low clone rates compared to previous studies. For instance, if a minimal clone length of 100 tokens (roughly 16 LOC) is requested, we found an average rate of duplicated type-2 clones of about 12%. Fortype-1 clones of this length, we found an average clone rate of only 1%.However, our results show also that cloning is common. We identified only 20% of the projects to have no type-2 clone of at least 100 tokens. And 44% of the projects have at least one type-1 clone of at least 100 tokens.