core.benchmark

Classes

Module Contents

class Benchmark
compare()

Prints a comparison table of all stored results.

measure(name: str, iterations: int = 10, warmup: int = 2)

A context manager or decorator to measure a block of code. Usage as Context Manager:

with benchmark.measure(“My Test”, iterations=50):

do_something()

results: Dict[str, BenchmarkResult]
class BenchmarkResult
property average
property best
iterations: int
name: str
property stdev

Standard Deviation helps you see how consistent the run was.

times: List[float] = []
property total
property worst