timeit — Measure execution time of small code snippets — Python 3.14.7 documentation

docs.python.org

Tin mới

The Python Profilers

trace — Trace or track Python statement execution

Python Module Index

3.14.7 Documentation

The Python Standard Library

Debugging and Profiling

time.perf_counter()

Changed in version 3.3: time.perf_counter() is now the default timer.

garbage collection

By default, timeit() temporarily turns off garbage collection during the timing. The advantage of this approach is that it makes independent timings more comparable. The disadvantage is that GC may be an important compon