BIS fnc codePerformance: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Fred Gandt (talk | contribs) m (Improved? readability of note) |
||
Line 44: | Line 44: | ||
<dd class="notedate">Posted on Mar 31, 2014 - 11:09 | <dd class="notedate">Posted on Mar 31, 2014 - 11:09 | ||
<dt class="note">'''[[User:ffur2007slx2_5|ffur2007slx2_5]]'''<dd class="note"> | <dt class="note">'''[[User:ffur2007slx2_5|ffur2007slx2_5]]'''<dd class="note"> | ||
(Environment: ArmA3 ver 1.14) Please always take advantage of the second and third parameters when running code on [[ | (Environment: ArmA3 ver 1.14) Please always take advantage of the second and third parameters when running code on [[BIS_fnc_codePerformance]]. And it is not suggested to use reserved variables under scheduled environment. E.g. | ||
<code> | <code>[' | ||
['[{a = _this}] spawn {private "_code"; _code = [_this,0,{},[{}]] call bis_fnc_param; | [ { a = _this } ] spawn { | ||
</code> | private "_code"; | ||
_code = [_this, 0, {}, [{}]] call bis_fnc_param; | |||
<code> | { _x call _code; } forEach AllUnits; | ||
['{private "_code"; _code = [_this,0,{},[{}]] call bis_fnc_param; | }; | ||
</code> | '] call bis_fnc_codeperformance;</code> | ||
There will be a great latency until GUI being displayed, never do like that, on the contrary, we should: | |||
<code>[' | |||
{ | |||
private "_code"; | |||
_code = [_this, 0, {}, [{}]] call bis_fnc_param; | |||
{ _x call _code; } forEach AllUnits; | |||
}' | |||
, [ {a = _this } ], 1000] call bis_fnc_codeperformance;</code> | |||
Separating all three parameters won’t have any problem. | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
</dl> | </dl> |
Revision as of 08:53, 31 March 2014
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. In Arma 3, window with results is opened afterwards. NOTE: For best results restart your client before conducting tests. This function uses diag_tickTime which loses its precision the longer the client runs from restart.
- Execution:
- call
- Groups:
- Uncategorised
Syntax
- Syntax:
- [expression(String),Any([parameters]),cycles(Number)] call BIS_fnc_codePerformance;
- Parameters:
- expression: String - tested expression
- Any (Optional): Param(s) - passed into code (default: [])
- cycles (Optional): Number - Number of cycles (default: 10000)
- Return Value:
- Nothing
Examples
- Example 1:
testArray = []; ["testArray = testArray + [1];"] call BIS_fnc_codePerformance; testArray = []; ["testArray set [count testArray,1];"] call BIS_fnc_codePerformance;
Compare two methods of adding elements into array
Additional Information
- See also:
- See also needed
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
- Posted on Mar 31, 2014 - 11:09
- ffur2007slx2_5
-
(Environment: ArmA3 ver 1.14) Please always take advantage of the second and third parameters when running code on BIS_fnc_codePerformance. And it is not suggested to use reserved variables under scheduled environment. E.g.
[' [ { a = _this } ] spawn { private "_code"; _code = [_this, 0, {}, [{}]] call bis_fnc_param; { _x call _code; } forEach AllUnits; }; '] call bis_fnc_codeperformance;
There will be a great latency until GUI being displayed, never do like that, on the contrary, we should:[' { private "_code"; _code = [_this, 0, {}, [{}]] call bis_fnc_param; { _x call _code; } forEach AllUnits; }' , [ {a = _this } ], 1000] call bis_fnc_codeperformance;
Separating all three parameters won’t have any problem.