Closed ampersand38 closed 1 year ago
@ampersand38 I changed it to check for ammo simulation which I think will be more generalized. Please merge if the changes look good to you.
For high rof weapons, do we want to cache the magazine to avoid having config look up every round?
I don't see why not always cache it. Or many other data, for that matter, especially if always local to the Server.
I don't think it is really needed (0.0011 ms improvement). Does not seem like the slow part of the function when testing with the laser designator turret. Can also revisit this later.
Result:
0.0021 ms
Cycles:
10000/10000
Code:
private _magazine = "Laserbatteries";
private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
private _ammoSimulation = getText (configFile >> "CfgAmmo" >> _ammo >> "simulation");
_ammoSimulation == "laserDesignate"
Result:
0.001 ms
Cycles:
10000/10000
Code:
private _magazine = "Laserbatteries";
private _ammoSimulation = a getOrDefaultCall [_magazine, {
private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
getText (configFile >> "CfgAmmo" >> _ammo >> "simulation")
}, true];
_ammoSimulation == "laserDesignate"
Result:
0.0269 ms
Cycles:
10000/10000
Code:
a call zen_common_fnc_fireWeapon
I meant for when the weapon is a machinegun or autocannon, but yeah it's probably fine. Good to merge then?
0.0021 ms [...] 0.001 ms
It's true that it ain't exactly very much, but since it only has a pro and no cons (AFAICT), and slowdowns eventually stack ... Plus the general good practices say that cache multiple-use stuff.
When merged this pull request will: