MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / repeat

Method repeat

tools/python-3.11.9-amd64/Lib/timeit.py:186–210  ·  view source on GitHub ↗

Call timeit() a few times. This is a convenience function that calls the timeit() repeatedly, returning a list of results. The first argument specifies how many times to call timeit(), defaulting to 5; the second argument specifies the timer argument, defaultin

(self, repeat=default_repeat, number=default_number)

Source from the content-addressed store, hash-verified

184 return timing
185
186 def repeat(self, repeat=default_repeat, number=default_number):
187 """Call timeit() a few times.
188
189 This is a convenience function that calls the timeit()
190 repeatedly, returning a list of results. The first argument
191 specifies how many times to call timeit(), defaulting to 5;
192 the second argument specifies the timer argument, defaulting
193 to one million.
194
195 Note: it's tempting to calculate mean and standard deviation
196 from the result vector and report these. However, this is not
197 very useful. In a typical case, the lowest value gives a
198 lower bound for how fast your machine can run the given code
199 snippet; higher values in the result vector are typically not
200 caused by variability in Python's speed, but by other
201 processes interfering with your timing accuracy. So the min()
202 of the result is probably the only number you should be
203 interested in. After that, you should look at the entire
204 vector and apply common sense rather than statistics.
205 """
206 r = []
207 for i in range(repeat):
208 t = self.timeit(number)
209 r.append(t)
210 return r
211
212 def autorange(self, callback=None):
213 """Return the number of loops and time taken so that total time >= 0.2.

Callers 5

mainFunction · 0.95
timeitMethod · 0.80
repeatFunction · 0.80
tokenizeFunction · 0.80

Calls 2

timeitMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected