I have written two algorithms to perform the Jacobi iterative method to simulate heat dissipation over a surface. I'd like to see if there is a significant difference between the run times of the two algorithms. I think that I can use a two-tailed statsmodels t-test to determine whether the means are not equal to one another, but I'd like to know if one is statistically significantly faster. How can I test to see which algorithm is statistically significantly faster?
Here is an example with the two-sample test.
from statsmodels.stats.weightstats import ttest_ind
# Example run times in seconds
algorithm_1_rtimes = [5, 5.5, 4.9]
algorithm_2_rtimes = [1.2, 1.1, 0.9]
_, pvalue, _ = ttest_ind(algorithm_1_rtimes, algorithm_2_rtimes)
if pvalue < 0.05:
print("Reject H0")
else:
print("Fail to reject H0")