I am using Jupyter notebook. I'm trying to measure how long will it take to count the Avogadro's number with python. I found that time.perf_counter() and time.process_time() modules will be useful for this kind of work. So I tried both of them, but the result was totally different. What makes this kind of difference? Here are my codes.
import time
a = 10 ** 5
def AvogadroCounting():
i = 0
while i <= a:
i += 1
AvogadroCounting()
t_fract = time.perf_counter() #time to count fraction of avogadro's number in Seconds
print(t_fract, 'secs')
and my notebook gives 693920.393636181 secs.
import time
a = 10 ** 5
def AvogadroCounting():
i = 0
while i <= a:
i += 1
AvogadroCounting()
t_fract = time.process_time() #time to count fraction of avogadro's number in Seconds
print(t_fract, 'secs')
and this gives 2048.768273 secs.