# Code Similarity and Location-Awareness Automatic Program Repair
## 4 Empirical Study
### Experimental Result
One of the reasons for this phenomenon is that the faults in the Defects4J bug dataset come from actual development, and the Math project has been developed for 11 years, so there are certain differences in the software composition of different versions of Math faults. Another reason for this phenomenon is that the bug program in Defects4J is very complicated and the program scale is large, which leads to different costs for repairing different bugs even in the same software project. The above reasons show that in the actual industry, the automatic repair of software faults is a discrete problem with weak regularity. It can be seen from the above that the repair ability of SLARepair is far better than that of GenProg, and the improvement of this repair ability comes from the guidance of code similarity information and the location-awareness repair. Code similarity information can enable SLARepair to search for the correct patch faster based on the original genetic programming, which is reflected in the fact that SLARepair can successfully repair with fewer candidate patches. Another reason why SLARepair has better repair capabilities is that the location-awareness repair approach greatly reduces the ingredient space. In order to verify the improvement of the location-awareness repair approach for repairing capabilities, we run SLARepair with the search scope of the repair ingredient limited to application, package, and category according to the description of location-awareness repair and calculate the specific repair time. For applications, the maximum time settings on packages and classes are 30 min, 60 min, and 90 min, respectively. Considering the cost of the experiment, we only experimented on the location-awareness repair capability of SLARepair on the Math project, and the experimental result is an average of 20 runs. Figure 8 shows the time consumption of each Math bug in different ingredient spaces in the form of a histogram, where the horizontal axis represents the ingredient space type and the vertical axis represents the repair time (unit: minutes). It can be seen from the figure that as the ingredient space shrinks from application to class, the repair time is declining, which shows that location-awareness repair can effectively improve the repair efficiency of SLARepair. In particular, in Figure 8d,j, the time consumption of the package is higher than \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**Subject**} & \multirow{2}{*}{**Bug Id**} & \multirow{2}{*}{**Approach**} & \multirow{2}{*}{**Time (min)**} & **Candidate** & **Reduced Repair** & **Reduced Candidate** \\  & & & & **Patches** & **Time** & **Patches** \\ \hline \multirow{4}{*}{Time} & \multirow{2}{*}{T4} & SLARepair & 8.9 & 23 & \multirow{2}{*}{47.3\%} & \multirow{2}{*}{36.1\%} \\  & & GenProg & 16.9 & 36 & & \\ \cline{2-6}  & \multirow{2}{*}{T11} & SLARepair & 6.5 & 12 & \multirow{2}{*}{16.7\%} & \multirow{2}{*}{14.3\%} \\  & & GenProg & 7.8 & 14 & & \\ \hline \multirow{2}{*}{average} & \multirow{2}{*}{} & SLARepair & 19.6 & 29 & \multirow{2}{*}{56.1\%} & \multirow{2}{*}{50.8\%} \\  & & GenProg & 44.6 & 59 & & \\ \hline \multirow{2}{*}{total} & \multirow{2}{*}{} & SLARepair & 491.1 & 713 & \multirow{2}{*}{55.9\%} & \multirow{2}{*}{51.0\%} \\  & & GenProg & 1114.8 & 1456 & & \\ \hline \hline \end{tabular}
\end{table} 
Table 3: _Cont._the application. This is because, in the actual repair process of the M20 bug and the M50 bug, too many complex invalid patches were generated in the package space during the actual repair process, resulting in excessive verification time. From Figure 8, we can also see that in some of the bugs, SLARepair cannot find the correct patch in a certain search space. For example, bugs M39, M40, M49, M70, and M74 cannot find effective patches in the class space. This is because the repair ingredients needed to repair these bugs are in a larger space or the time required to find the correct repair ingredients exceeds 30 min.