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

Method timeit

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

Time 'number' executions of the main statement. To be precise, this executes the setup statement once, and then returns the time it takes to execute the main statement a number of times, as float seconds if using the default timer. The argument is the number o

(self, number=default_number)

Source from the content-addressed store, hash-verified

164 traceback.print_exc(file=file)
165
166 def timeit(self, number=default_number):
167 """Time 'number' executions of the main statement.
168
169 To be precise, this executes the setup statement once, and
170 then returns the time it takes to execute the main statement
171 a number of times, as float seconds if using the default timer. The
172 argument is the number of times through the loop, defaulting
173 to one million. The main statement, the setup statement and
174 the timer function to be used are passed to the constructor.
175 """
176 it = itertools.repeat(None, number)
177 gcold = gc.isenabled()
178 gc.disable()
179 try:
180 timing = self.inner(it, self.timer)
181 finally:
182 if gcold:
183 gc.enable()
184 return timing
185
186 def repeat(self, repeat=default_repeat, number=default_number):
187 """Call timeit() a few times.

Callers 3

repeatMethod · 0.95
autorangeMethod · 0.95
timeitFunction · 0.80

Calls 4

repeatMethod · 0.80
disableMethod · 0.45
innerMethod · 0.45
enableMethod · 0.45

Tested by

no test coverage detected