Skip to main content
Log in

Mojo function

run

run[func: fn() -> None](num_warmup: Int = 2, max_iters: Int = 1000000000, min_runtime_secs: SIMD[float64, 1] = 2, max_runtime_secs: SIMD[float64, 1] = 60, max_batch_size: Int = 0) -> Report

Benchmarks the function passed in as a parameter.

Benchmarking continues until 'min_time_ns' has elapsed and either max_time_ns OR max_iters is achieved.

Parameters:

  • func (fn() -> None): The function to benchmark.

Args:

  • num_warmup (Int): Number of warmup iterations to run before starting benchmarking (default 2).
  • max_iters (Int): Max number of iterations to run (default 1_000_000_000).
  • min_runtime_secs (SIMD[float64, 1]): Upper bound on benchmarking time in secs (default 2).
  • max_runtime_secs (SIMD[float64, 1]): Lower bound on benchmarking time in secs (default 60).
  • max_batch_size (Int): The maximum number of iterations to perform per time measurement.

Returns:

Average execution time of func in ns.

run[func: fn() capturing -> None](num_warmup: Int = 2, max_iters: Int = 1000000000, min_runtime_secs: SIMD[float64, 1] = 2, max_runtime_secs: SIMD[float64, 1] = 60, max_batch_size: Int = 0) -> Report

Benchmarks the function passed in as a parameter.

Benchmarking continues until 'min_time_ns' has elapsed and either max_time_ns OR max_iters is achieved.

Parameters:

  • func (fn() capturing -> None): The function to benchmark.

Args:

  • num_warmup (Int): Number of warmup iterations to run before starting benchmarking (default 2).
  • max_iters (Int): Max number of iterations to run (default 1_000_000_000).
  • min_runtime_secs (SIMD[float64, 1]): Upper bound on benchmarking time in secs (default 2).
  • max_runtime_secs (SIMD[float64, 1]): Lower bound on benchmarking time in secs (default 60).
  • max_batch_size (Int): The maximum number of iterations to perform per time measurement.

Returns:

Average execution time of func in ns.

Was this page helpful?