{"library":"pytest-benchmark","code":"import time\n\ndef something(duration=0.000001):\n    \"\"\" Function that needs some serious benchmarking. \"\"\"\n    time.sleep(duration)\n    return 123\n\ndef test_my_stuff(benchmark):\n    # benchmark something\n    result = benchmark(something)\n    assert result == 123\n\n# To run: save the above as a Python file (e.g., test_benchmarks.py) and run `pytest` from your terminal.\n# Use `pytest --benchmark-autosave --benchmark-json=report.json` for advanced features.","lang":"python","description":"Define a test function that accepts the `benchmark` fixture. Pass the function you wish to benchmark as the first argument to `benchmark()`. You can also pass positional and keyword arguments to the benchmarked function. Running `pytest` will execute the benchmarks and display a summary table.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}