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

Use fast static array for default param #509

Merged
merged 1 commit into from Sep 23, 2016
Merged

Use fast static array for default param #509

merged 1 commit into from Sep 23, 2016

Conversation

PabstMirror
Copy link
Contributor

Minor performance improvment from #503

AAA = {
    params [["_hash", [] call CBA_fnc_hashCreate, [[]]], "_key"];
    _key in (_hash select 1); 
};
BBB = {
    params [["_hash", [[], []], [[]]], "_key"];
    _key in (_hash select 1); 
};
hash = ["#CBA_HASH#",["A","B","C","D","E"],[1,2,3,4,5],nil];

return = [hash, "A"] call AAA;
return = [hash, "B"] call AAA;
return = [hash, "C"] call AAA;
return = [hash, "D"] call AAA;
return = [hash, "E"] call AAA;
return = [hash, "F"] call AAA;
return = [hash, "G"] call AAA;
return = [hash, "H"] call AAA;
return = [hash, "I"] call AAA;
return = [hash, "J"] call AAA;
// 0.167224 ms

return = [hash, "A"] call BBB;
return = [hash, "B"] call BBB;
return = [hash, "C"] call BBB;
return = [hash, "D"] call BBB;
return = [hash, "E"] call BBB;
return = [hash, "F"] call BBB;
return = [hash, "G"] call BBB;
return = [hash, "H"] call BBB;
return = [hash, "I"] call BBB;
return = [hash, "J"] call BBB;
// 0.0507 ms

@PabstMirror PabstMirror added this to the 3.1 milestone Sep 23, 2016
@commy2
Copy link
Contributor

commy2 commented Sep 23, 2016

Yeah. This "dummy hash" should be good enough for this.

@commy2 commy2 merged commit b04553d into master Sep 23, 2016
@commy2 commy2 deleted the hashhaskeyDefault branch September 23, 2016 17:57
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