I have a java code that calculate the running time for multiple sorting algorithms such as "Merge sort , Bubble sort and so on ..".
The running time after the first algorithm is not calculated correctly due to branch prediction. So is there anyway to avoid branch prediction to get the correct running time.
Example:Running time for revers sorted array with length 200000 index is as below:
Average runtime for Merge Sort in seconds after 10 iteration is : 0.0204354182
Average runtime for Bubble Sort in seconds after 10 iteration is : 1.0596160000000001E-4
As you see the bubble sort running time is not correct, it should be more than the running time for merge sort for such array.
Appreciate your help.