how-to

How to Benchmark a Function

Measure speedup correctly from start to finish.

Published May 30, 2026

Step 1: Identify the Function

def process_data(records):
    return [r['value'] * 2 for r in records]

Step 2: Run Benchmark

pyvorin benchmark script.py --function process_data --runs 10

Step 3: Review Output

Check CPython median, Pyvorin median, speedup factor, and timing quality.

Step 4: Validate Correctness

Ensure correctness_match=True before using the speedup.