Riferimento API di nanos world Documentazione italiana non ufficiale
Documentazione ufficiale
Funzione statica Condiviso

NanosUtils.Benchmark

Benchmarks a function performance, outputs in the console the elapsed time

Non ancora tradotto

Sintassi

Lua
NanosUtils.Benchmark(name, amount, func, args...)

Parametri

Nome Tipo Predefinito Descrizione
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

Valore restituito

  • number the elapsed time in milliseconds

Esempi

Benchmarks a function
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),