Benchmarks a function to see how long it will take to execute.
Recommended to run with small number of iterations first and build up, to prevent locking up the machine.
_function | Function to test [Function] |
_parameters | Parameters to pass to the function on each iteration [Array or nil] |
_iterations | Number of iterations to run, in order to get an accurate average time [Number] |
Average execution time [Number]
// Array creation through use of push. _array = []; _took = [{ _array set [count _array, 1] }, nil, 1000] call CBA_fnc_benchmarkFunction; // Array creation through use of concatenation. _array = []; _took = [{ _array = _array + [1] }, nil, 1000] call CBA_fnc_benchmarkFunction; // "Null function" to compare to (use as a control vs. operation time // of other functions). _array = []; _took = [{}, nil, 1000] call CBA_fnc_benchmarkFunction;
Spooner