Static function
NanosUtils.Benchmark
Benchmarks a function performance, outputs in the console the elapsed time
Syntax
NanosUtils.Benchmark(name, amount, func, args...)
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name
|
string | — | Benchmark name to output |
amount
|
number | — | Amount of times to loop |
func
|
function | — | The function to call |
args...
|
any | — | The arguments of the function to call |
Returns
- number the elapsed time in milliseconds
Examples
local arg1 = math.random(),local arg2 = math.random(),,NanosUtils.Benchmark("My Heavy Operation", 1000, function(param1, param2), -- Do some heavy operations here, local result = param1 * param2,end, arg1, arg2),