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