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 interactEH function #6406

Merged
merged 2 commits into from Jul 13, 2018

Conversation

Projects
None yet
5 participants
@mharis001
Contributor

mharis001 commented Jun 24, 2018

When merged this pull request will:

  • Optimize explosives interactEH function (various minor improvements but mainly createVehicleLocal [0, 0, 0])

Performance results for ace_explosives_interactEH_counter:

Test Old New
count allMines = 30 (somewhat close) 0.09198s / 43 = 2.13907ms 0.0169678s / 35 = 0.484794ms
count allMines = 42 (nearby) 0.0439453s / 24 = 1.83105ms 0.0249634s / 28 = 0.891549ms
count allMines = 47 (far away) 0.00402832s / 31 = 0.129946ms 0.00604248s / 59 = 0.102415ms
count allMines = 159 (nearby) 0.685913s / 106 = 6.47088ms 0.248962s / 123 = 2.02408ms

@jonpas jonpas added this to the 3.13.0 milestone Jun 24, 2018

@mharis001 mharis001 changed the title from Explosives- Optimize interactEH function to Explosives - Optimize interactEH function Jun 24, 2018

@dedmen

dedmen approved these changes Jun 25, 2018

If this is a perf improvement you might aswell go crazy overkill :D

} else {
// Prevent Rare Error when ending mission with interact key down:
if (isNull ace_player) exitWith {};
if (isNull ACE_player) exitWith {};
private _player = ACE_player;

This comment has been minimized.

@dedmen

dedmen Jun 25, 2018

Contributor

Accessing global variable is slower than local. So swap the order of the isNull and _player and reuse _player maybe.

//If player moved >5 meters from last pos, then rescan
if (((getPosASL ace_player) distance _setPosition) > 5) then {
// Rescan if player has moved more than 5 meters from last position
if (_playerPos distance _setPosition > 5) then {

This comment has been minimized.

@dedmen

dedmen Jun 25, 2018

Contributor

distanceSqr? But I don't think that makes enough difference

This comment has been minimized.

@mharis001

mharis001 Jun 25, 2018

Contributor

might as well 😃

@thojkooi

This change looks sensible. The change from Public to Private in the function header seems like it should not be part of this PR, but I think it makes sense for this function.

I'd leave this to @jonpas or @commy2 to merge.

@mharis001

This comment has been minimized.

Contributor

mharis001 commented Jul 8, 2018

I changed it from public Yes to No, because I don't see any reason why this function would be a public function.

@PabstMirror PabstMirror modified the milestones: 3.13.0, 3.12.3 Jul 13, 2018

@PabstMirror PabstMirror merged commit a84daca into acemod:master Jul 13, 2018

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

@mharis001 mharis001 deleted the mharis001:explosives-interactEH branch Aug 29, 2018

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