Why am I getting each time I execute the following program different times for t1_perf_time and t1_timeit_time? Why are the times not for every execution the same?
import numpy as np
import time
import timeit
t0_process_time = time.process_time()
t0_perf_time = time.perf_counter()
t0_timeit = timeit.default_timer()
x = np.array([[[1, 2],
[3, 4]],
[[5, 6],
[7, 8]],
[[3, 1],
[1, 5]]])
x_min = np.amin(x, axis=0)
print(x_min)
print("t1_process_time: ", time.process_time() - t0_process_time)
print("t1_perf_time: ", time.perf_counter() - t0_perf_time)
print("t1_timeit_time: ", timeit.default_timer() - t0_timeit)
The results are as follows:
Execution of the program: t1_process_time: 0.0; t1_perf_time: 0.0008847999852150679; t1_timeit_time: 0.0009033000096678734
Execution of the program: t1_process_time: 0.0; t1_perf_time: 0.0003133999998681247; t1_timeit_time: 0.0003309999592602253
Execution of the program: t1_process_time: 0.0; t1_perf_time: 0.000278300023637712; t1_timeit_time: 0.0003150000120513141