BIS fnc codePerformance: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (note about restart) |
Lou Montana (talk | contribs) m (Text replacement - "(Optional, default {{hl|[]}})" to "(Optional, default <sqf inline>[]</sqf>)") |
||
(63 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{RV|type=function | ||
| arma3|= | |game1= arma3 | ||
|version1= 0.50 | |||
| | |gr1= Diagnostic | ||
| 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. | |descr= [[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> | |||
This function is using [[diag_codePerformance]] command. | |||
{{Feature|informative|Use [[toString]] to stringify [[Code]], as [[str]] adds curly braces - See {{Link|#Example 2}}.}} | |||
|s1= [expression, arguments, cycles, display] call [[BIS_fnc_codePerformance]] | |||
[[ | |p1= expression: [[String]] - tested expression | ||
| [ | |p2= arguments: [[Anything]] - (Optional, default <sqf inline>[]</sqf>) arguments to pass into the code | ||
| | |p3= cycles: [[Number]] - (Optional, default 10000) number of wanted cycles | ||
| [[ | |p4= display: [[Display]] - (Optional, default <sqf inline>findDisplay 46</sqf>) display in which the message window with results will be opened. Use [[displayNull]] to disable the window | ||
|r1= [[Number]] - average execution time of the expression | |||
|x1= < | |||
|x1= <sqf> | |||
// compare three methods of adding elements into array | |||
testArray = []; | testArray = []; | ||
["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; | |||
</sqf> | |||
|x2= <sqf>[toString { hint "Hello there" }] call BIS_fnc_codePerformance;</sqf> | |||
|seealso= [[diag_codePerformance]] | |||
}} | }} | ||
Latest revision as of 18:09, 8 November 2023
Description
- 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. - Execution:
- call
- Groups:
- Diagnostic
Syntax
- Syntax:
- [expression, arguments, cycles, display] call BIS_fnc_codePerformance
- Parameters:
- expression: String - tested expression
- arguments: Anything - (Optional, default []) arguments to pass into the code
- cycles: Number - (Optional, default 10000) number of wanted cycles
- display: Display - (Optional, default findDisplay 46) display in which the message window with results will be opened. Use displayNull to disable the window
- Return Value:
- Number - average execution time of the expression
Examples
- Example 1:
- Example 2:
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