BIS fnc codePerformance: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...)
Line 1: Line 1:
{{Function|Comments=
{{Function


| arma3|Game name=
| arma3


|0.50|Game version=
|0.50


|gr1 = Diagnostic |GROUP1=
|gr1 = Diagnostic


| [[File:BIS fnc codePerformance.png|300px|right]]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. <br>
| [[File:BIS fnc codePerformance.png|300px|right]]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. <br>
Line 11: Line 11:
<br>
<br>
Keep in mind that this takes string, and that you can't pass <code>[[str]] _code</code> as string because that add's curly braces to the string.
Keep in mind that this takes string, and that you can't pass <code>[[str]] _code</code> as string because that add's curly braces to the string.
|DESCRIPTION=


| [expression, arguments, cycles, display] call [[BIS_fnc_codePerformance]] |SYNTAX=


|p1= expression: [[String]] - Tested expression |Parameter1=
| [expression, arguments, cycles, display] call [[BIS_fnc_codePerformance]]
|p2= arguments (Optional): [[Anything]] - Arguments to pass into the code.  Default: [] |Parameter2=


|p3= cycles (Optional): [[Number]] - Number of wanted cycles. Default: 10000 |PARAMETER3=
|p1= expression: [[String]] - Tested expression
|p4 = display (Optional): [[Display]] - Display in which the message window with results will be opened. Use [[displayNull]] to disable the window. Default: Current mission display |PARAMETER4=
|p2= arguments (Optional): [[Anything]] - Arguments to pass into the code. Default: []


| [[Number]] - Average execution time of the expression|RETURNVALUE=
|p3= cycles (Optional): [[Number]] - Number of wanted cycles. Default: 10000
|p4 = display (Optional): [[Display]] - Display in which the message window with results will be opened. Use [[displayNull]] to disable the window. Default: Current mission display
 
| [[Number]] - Average execution time of the expression
   
   
|x1= <code>testArray = [];
|x1= <code>testArray = [];
Line 30: Line 30:
["testArray [[pushBack]] 1"] [[call]] [[BIS_fnc_codePerformance]];
["testArray [[pushBack]] 1"] [[call]] [[BIS_fnc_codePerformance]];
</code>
</code>
Compare three methods of adding elements into array|EXAMPLE1=
Compare three methods of adding elements into array




| [[diag_codePerformance]] |SEEALSO=
| [[diag_codePerformance]]


}}
}}

Revision as of 23:37, 17 January 2021

Hover & click on the images for description

Description

Description:
BIS fnc codePerformance.png
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.

Keep in mind that this takes string, and that you can't pass str _code as string because that add's curly braces to the string.
Execution:
call
Groups:
Diagnostic

Syntax

Syntax:
[expression, arguments, cycles, display] call BIS_fnc_codePerformance
Parameters:
expression: String - Tested expression
arguments (Optional): Anything - Arguments to pass into the code. Default: []
cycles (Optional): Number - Number of wanted cycles. Default: 10000
display (Optional): Display - Display in which the message window with results will be opened. Use displayNull to disable the window. Default: Current mission display
Return Value:
Number - Average execution time of the expression

Examples

Example 1:
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; Compare three methods of adding elements into array

Additional Information

See also:
diag_codePerformance

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section