Fandom

武装突袭 Wiki

BIS_fnc_codePerformance

简体 | 繁體

4,827个页面创建
于此维基上
添加新页面
评论0 分享

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。

Introduced with Arma 3 version 0.50
  

Click on the images for descriptions

Introduced in

Game:
Arma 3
Version:
0.50

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.

300px

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

Execution:
call
Multiplayer:
-
See also:

See also needed

Notes

Only post proven facts here. Report bugs on the feedback tracker. Use the talk page or the forums for discussions.
Add New Note | How To

Notes

Posted on Mar 31, 2014 - 11:09
ffur2007slx2_5
(ArmA3 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; As for the third parameter, only run the code with desired loop and not always 1000 times like the default set: [‘

a = 0; b = true;
for [{_i = 0},{_i < 10 && b},{_i = _i + 1}] do {
  a = a + 1; 
  if (a >= 7) then {b = false};
};’
,[],1000] call BIS_fnc_codePerformance;

//Sometimes such 1000 loops will freeze the game directly. So separating all three parameters and using them wisely are recommended.

Bottom Section

更多维基

随机维基