## 4 Results
### Enhancement of Performance Degradation Factors  
We define and detect degradation factor patterns to improve the performance of the smart traffic control simulator.  
Figure 13 shows the source code for improving loop unrolling before and after refactoring. The case that is before improvement repeated the operation with i increasing by 1 from 0 to 1,000,000. Thereafter, we divide the sum by i*1.93. The code after the improvement can improve the performance by executing the functions in one iteration from i to i + 3 at once and the total number of iterations is reduced by 25%. The result is a 0.21% performance improvement that is increased by running all the loops, which takes 3.3849 [ms], and running less iterations, which takes 3.3841 [ms], that is, the performance is improved as the number of iterations decreases.  
Figure 14 shows the source code before and after improving the loop down counter. In the source code before improvement, 'i' increased by 1 from 0 to 1,000,000. In the code after the improvement, we set the initial value of 'i' to 1,000,000, decreased 'i' by 1, and repeated until 'i' is zero. As a result, each execution time before and after the improvement is 3.86 [ms] and 3.85 [ms], respectively. Therefore, the performance is improved by about 0.26%. Compared with the up counter before improvement, the down counter does not allocate a register to store the final value. The down counter does not compare the value with zero each time. It can also reduce one command that compares 'i' with a number.  
Figure 12: Enhancement of performance after refactoring external into data/stamp coupling.  
Figure 13: Before and after improving loop unrolling.  
Figure 15 shows the source code before and after the improvement for unnecessary control statements inside the loop. In this code, 'i' is increased by 1 from 0 to 1,000,000. Here, we discuss the code ('if (i% 4 == 0)'). If the remainder is different, this code performs different functions through an 'if statement'. The result of the performance measurement is 90.72 [ms]. Meanwhile, like the previous loop unrolling, it performs i - i + 3 at once and reduces the number of repetitions to 25% of the original code. The performance measurement result of this method is 53.82 [ms]. In other words, the performance measurement time is reduced from 90.72 [ms] to 53.82 [ms], and 40.67% improvement is achieved. The reason for the improvement is that the branch does not execute because the 'if then else statement' inside the loop is missing. In addition, the code after the improvement has reduced the number of iterations like loop unrolling.  
Figure 16 shows the source code before and after the improvement for multiple if-then-else statements. The code before improvement differs from the remainder when the codes are divided by 5 through multiple if-then-else statements. Depending on the remainder, the sum value of the code may have a different value. Refactoring this code into a switch-case statement puts 'i%5' in the conditional statement of the switch statement. Depending on the value obtained from the result, the code for different case statements is executed. The improved code takes 664.993 [ms]. In other words, the performance measurement time is reduced from 686.377 [ms] to 664.993 [ms]. This means that there is a 3.12% performance improvement. The reason for the improvement is that, when multiple if then else statements are executed, all the conditions are compared. The function is performed on the branch statement that also satisfies the condition. However, the code that is improved with switch-case statements can perform functions at once without requiring multiple comparisons.  
Figure 14: Before and after improving loop down counter.  
Figure 15: Before and after improving unnecessary control statement inside the loop.