BIS fnc codePerformance: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(updated docs, format, example)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[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 and timing is copied to clipboard. This function is using [[diag_codePerformance]] command.
| [[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. This function is using [[diag_codePerformance]] command.|= Description
 
 
 
|= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| [expression([[String]]),Any([parameters]),cycles([[Number]])] call BIS_fnc_codePerformance; |= Syntax
| [expression, arguments, cycles, display] call [[BIS_fnc_codePerformance]] |= Syntax


|p1= '''expression''': [[String]] - tested expression |=
|p1= expression: [[String]] - Tested expression |=
|p2= '''Any''' (Optional): Param(s) - passed into code (default: []) |=
|p2= arguments (Optional): [[Anything]] - Arguments to pass into the code.  Default: [] |=
|p3= '''cycles''' (Optional): [[Number]] - Number of cycles (default: 10000) |=
|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


| [[Nothing]] |= Return value
| [[Number]] - Average execution time of the expression|= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <code>testArray = [];
|x1= <code>testArray = [];
["testArray = testArray + [1];"] [[call]] [[BIS_fnc_codePerformance]];
["testArray = testArray + [1]"] [[call]] [[BIS_fnc_codePerformance]];
testArray = [];
["testArray [[set]] <nowiki>[</nowiki>[[count]] testArray, 1]"] [[call]] [[BIS_fnc_codePerformance]];
testArray = [];
testArray = [];
["testArray [[set]] <nowiki>[</nowiki>[[count]] testArray,1];"] [[call]] [[BIS_fnc_codePerformance]];
["testArray [[pushBack]] 1"] [[call]] [[BIS_fnc_codePerformance]];
</code>
</code>
Compare two methods of adding elements into array|=  
Compare three methods of adding elements into array|=  


____________________________________________________________________________________________
____________________________________________________________________________________________

Revision as of 15:19, 18 July 2017

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.
Execution:
call
Groups:
Uncategorised

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