Page MenuHomeFeedback Tracker

<b>BIS_fnc_listPlayers</b> may be refactored for better performance
New, WishlistPublic

Description

Right now, this function counts the array all over again whenever an element is added. But since the command pushBack exists, it can be refactored to be much more efficient:

private ["_players"];

//--- Search in allUnits, otherwise dead players are ignored
_players = [];
{
if (isplayer _x) then {_players pushBack _x;};
} foreach (allunits + alldead);

_players

Details

Legacy ID
812987666
Severity
None
Resolution
Open
Reproducibility
Always
Category
Scripting
Steps To Reproduce

n/a

Additional Information

There's two files called <i>"fn_listPlayers.sqf"</i> in the <i>functions_f.pbo</i>, one in the sub directory "Misc", the other one in "Network", while only the "Misc" version is actually used.

Not a big deal, but it cought my attention.

Event Timeline

HereisJohnny edited Additional Information. (Show Details)
HereisJohnny set Category to Scripting.
HereisJohnny set Reproducibility to Always.
HereisJohnny set Severity to None.
HereisJohnny set Resolution to Open.
HereisJohnny set Legacy ID to 812987666.May 8 2016, 11:36 AM