Module benchmark
A module for benchmarking arbitrary Lua code.
Functions
benchmark (f, ...) | Benchmark a function with given arguments. |
benchmark_n (num, f, ...) | Benchmark a function, running it a given number of times. |
Functions
- benchmark (f, ...)
-
Benchmark a function with given arguments.
Parameters:
- f The function to call
- ... Any arguments to pass to the function f
Returns:
-
The time the function took, in seconds
- benchmark_n (num, f, ...)
-
Benchmark a function, running it a given number of times.
Parameters:
- num The number of times to run the function
- f The function to call
- ... Any arguments to pass to the function f
Returns:
- The average time taken
- The total time taken