MCPcopy Index your code
hub / github.com/RustPython/RustPython / repeat

Method repeat

Lib/timeit.py:183–207  ·  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, defaulting

(self, repeat=default_repeat, number=default_number)

Source from the content-addressed store, hash-verified

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

Callers 6

mainFunction · 0.95
repeatMethod · 0.95
_signature_fromstrFunction · 0.45
timeitMethod · 0.45
repeatFunction · 0.45

Calls 2

timeitMethod · 0.95
appendMethod · 0.45

Tested by 1

repeatMethod · 0.76