timeit.default_timer()
timeit.default_timer() is a Python function in the Timeit Module category. Default timer for timeit (uses time.perf_counter). The syntax is timeit.default_timer(). Returns: Float seconds. A typical example: start = timeit.default_timer()
# do work
end = timeit.default_timer()
print(end - start). A close sibling is timeit.timeit(), which times the execution of a small Python code snippet. A close sibling is timeit.repeat(), which like timeit() but runs multiple times and returns a list of results. A close sibling is timeit.Timer(), which creates a Timer object for repeated timing of code. More about this category: Code timing — timeit, repeat, default_timer. Related Timeit Module entries: timeit.timeit(), timeit.repeat(), timeit.Timer(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try timeit.default_timer() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.