Skip to content
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

More optimization #179

Merged
merged 7 commits into from
Jan 27, 2017
Merged

More optimization #179

merged 7 commits into from
Jan 27, 2017

Conversation

Sniperhid
Copy link
Member

When merged this pull request will:

  • Parameter formatters for calling extensions should be faster.
  • HASH_KEYS macro is now faster
  • Various improvements using apply and select. Including several serializers and deserializers are now faster.
  • Adds functions for caching frequently used config lookups acre_sys_radio_fnc_isBaseClassRadio and acre_sys_radio_fnc_isUniqueRadio.

@jonpas jonpas added this to the 2.4.0 milestone Jan 27, 2017
Copy link
Member

@jonpas jonpas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some possible improvements.

_list pushBack ((GVAR(languages) select _x) select 0);
} forEach ACRE_SPOKEN_LANGUAGES;
_list
ACRE_SPOKEN_LANGUAGES apply {((GVAR(languages) select _x) select 0);};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for extra parenthesis and semi-colon.
ACRE_SPOKEN_LANGUAGES apply {(GVAR(languages) select _x) select 0};

@@ -16,11 +16,8 @@
#include "script_component.hpp"

private _list = _this;
private _languageIds = [];
private _languageIds = _list apply {([_x] call FUNC(getLanguageId))};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you have with parenthesis! :P
private _languageIds = _list apply {[_x] call FUNC(getLanguageId)};

if (IS_ARRAY(_val)) then {
_val = _val call FUNC(_arraySerialize);
};
if (IS_HASH(_val)) then {
_val = _val call FUNC(_hashSerialize);
};
_vals pushBack _val;
true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return value? No semi-colon.


private _isBaseClassRadio = false;

if (HASH_HASKEY(GVAR(radioBaseClassCache),_this)) then {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if-exitwith is faster than if-then-else in this case, as it will only cache it on first call and then just needs the value.

@@ -18,7 +18,7 @@

params ["_player", "_class", "_callback", ["_replacementId",""]];

if (getNumber (configFile >> "CfgWeapons" >> _class >> "acre_hasUnique") == 0) then {
if (!(_class call EFUNC(sys_radio,isBaseClassRadio))) then {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if !(_class call EFUNC(sys_radio,isBaseClassRadio)) then { makes it easier to read IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants