Arma 3 Scripting

BIS_fnc_codePerformance

  • Arma 3 v0.50

Function · Markdown · JSON · original wiki page

Description

Measures how much time it takes to execute given expression. Results may vary based on overall performance; use this function to compare alternative scripting approaches rather than to measure specific values. Upon function execution, window with results is opened. The user then has a choice to copy the result into clipboard or not.
This function is using diag_codePerformance command.

Note

Use toString to stringify Code, as str adds curly braces - See Example 2.

Syntax

[expression, arguments, cycles, display] call BIS_fnc_codePerformance

Parameters:

Returns: Number - average execution time of the expression

Examples

Example 1

// compare three methods of adding elements into array
testArray = [];
["testArray = testArray + [1]"] call BIS_fnc_codePerformance;
testArray = [];
["testArray set [count testArray, 1]"] call BIS_fnc_codePerformance;
testArray = [];
["testArray pushBack 1"] call BIS_fnc_codePerformance;

Example 2

[toString { hint "Hello there" }] call BIS_fnc_codePerformance;

See also

diag_codePerformance