simplebench.cli module🔗

CLI script support for SimpleBench.

simplebench.cli.main(
benchmark_cases: Sequence[Case] | None = None,
*,
argv: list[str] | None = None,
extra_args: list[str] | None = None,
) int[source]🔗

Main entry point for running benchmarks via a command-line interface.

This function is responsible for setting up the command-line interface, parsing arguments, and executing the benchmark cases.

@benchmark() decorated cases are automatically included and added to the list of benchmark cases passed to this function.

Usage:

This function serves as the main entry point for running benchmarks.

Parameters:
  • benchmark_cases (Optional[Sequence[Case]]) – A Sequence of SimpleBench.Case instances to be benchmarked.

  • argv (Optional[list[str]]) – A list of command-line arguments to parse. If None, defaults to sys.argv.

  • extra_args (Optional[list[str]]) – Additional command-line arguments to include.

Returns:

An integer exit code.

Return type:

int