Skip to main content
Log in

Mojo function

run

run[func: fn() raises -> None](max_iters: Int = 1000000000, min_runtime_secs: SIMD[float64, 1] = SIMD(2), max_runtime_secs: SIMD[float64, 1] = SIMD(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() raises -> None): The function to benchmark.

Args:

  • 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() -> None](max_iters: Int = 1000000000, min_runtime_secs: SIMD[float64, 1] = SIMD(2), max_runtime_secs: SIMD[float64, 1] = SIMD(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:

  • 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[: origin.set, //, func: fn() raises capturing -> None](max_iters: Int = 1000000000, min_runtime_secs: SIMD[float64, 1] = SIMD(2), max_runtime_secs: SIMD[float64, 1] = SIMD(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() raises capturing -> None): The function to benchmark.

Args:

  • 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[: origin.set, //, func: fn() capturing -> None](max_iters: Int = 1000000000, min_runtime_secs: SIMD[float64, 1] = SIMD(2), max_runtime_secs: SIMD[float64, 1] = SIMD(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:

  • 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.