-
Notifications
You must be signed in to change notification settings - Fork 739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explosives - Optimize creating explosive place actions #6413
Explosives - Optimize creating explosive place actions #6413
Conversation
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing to object. Beautiful work :3 Awoooo
I would not remove a public function. Some people do look at the code and by removing it you may break somethinget like other mode or missions |
hasExplosives still sounds useful. But atleast add that arrayIntersect fix to it |
@TheMagnetar are you using it? If it's not marked "Public: Yes" it's not meant for public use. Of course if someone uses it still, it's up to them to pay attention and update it or request it to be made public API properly. |
^ hasExplosive is indeed marked public jonpas. imho if public funcs are removed a core dev should make an announcement on the forums and website to have the maximum visibility. As to the usefulness of said func, i'd say it has it's place. edit: it's used here @mharis001 |
That use is taken out in this PR, if the player has no explosives, there wont be any children actions and the action wont show anyway. Will update |
Oh maybe I should've read the other comments properly... Yeah, as a Public function we have to keep backwards compatibility. If it's essentially deprecated, then mark it as so with the |
The function isn't getting a better alternative, I just thought about removing it since it isn't used anywhere is ace. Still deprecate? |
|
||
_result | ||
_magazines arrayIntersect _magazines findIf {getNumber (_cfgMagazines >> _x >> QGVAR(Placeable)) == 1} > -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(_magazines arrayIntersect _magazines) findIf {getNumber (_cfgMagazines >> _x >> QGVAR(Placeable)) == 1} > -1
¯\_(ツ)_/¯ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙄 Awoooo
* Optimize explosive actions * Optimize hasExplosives function * Readability parentheses * bump * testing... * last try * for science * fix for sqf_validator
When merged this pull request will:
All of these were tested with
count magazines = 28
andplaceable explosives => 6, 2, 1, 1
(where each number represents the amount of a unique type of explosive).ACE_Place
action took ~0.1 ms (time it takeshasExplosives
)Overall: Instead of ~0.41 ms every second, the new method is ~0.23 ms after a change in the player's loadout and then ~0.009 ms (accessing the cached value) every second after that.
For an inventory with no placeable explosives and
count magazines = 17
: it is ~0.11 ms vs ~0.10 ms (first time after loadout change) and ~0.009 ms every time after that.