I can not understand the difference between number
and repeat
in timeit
library, so would you kindly tell me what is the difference between them?
repeat
specifies the number of samples to take.
number
specifies the number of times to repeat the code for each sample.
Internally there is a loop like this:
samples = []
for _ in range(repeat):
# start timer
for _ in range(number):
do_work()
# end timer
samples.append(duration)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With