-
Notifications
You must be signed in to change notification settings - Fork 148
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
Fix issues with PerFrameHandlers #236
Conversation
@commy2 why you remove the clean up of the perFrameHandlerArray again? that remove every performance improvement i did? |
Can you explain what you mean? There are no checks added in this PR, only stuff removed or moved around. |
you remove https://github.com/CBATeam/CBA_A3/pull/236/files#diff-173548a824c3a52bc2c10f270fd8dc72L44 this completly and that cleanup the perFrameHandlerArray to improve performance and remove nil from this perFrameHandlerArray array so that dont run throw the Basic Frame handler |
There are no Try this:
|
ok now i see what you did 👍 |
Yeah. You might have been thinking of
|
{ | ||
_x params ["", "", "", "", "", "_handle"]; | ||
GVAR(PFHhandles) set [_handle, _forEachIndex]; | ||
} forEach GVAR(perFrameHandlerArray); |
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.
This forEach loop needs to be above line 32 or it will fail on 2nd call to :
x_A = [{ diag_log text format ["---%1 - A Running %2", diag_tickTime, (_this select 1)]; }, 5, []] call CBA_fnc_addPerFrameHandler;
x_B = [{ diag_log text format ["---%1 - B Running %2", diag_tickTime, (_this select 1)]; }, 5, []] call CBA_fnc_addPerFrameHandler;
[x_A] call CBA_fnc_removePerFrameHandler;
[x_B] call CBA_fnc_removePerFrameHandler;
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.
All we really need is to find index of the top level _handle
in the perFrameHandlerArray
array, so, we could add an exit to the loop and skip the set I think.
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.
Using a find
would be slow when GVAR(PFHhandles)
get's big. With this method you only have to iterate through the PFHs that are still active. No idea which one is better. This is what already was there.
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.
Derp. The problem is that the public handle is pushed to GVAR(PFHhandles)
(which is for the internal handles, those who can change).
Thats why removing the PFH twice "works". The loop auto corrects the internal handle...
i knew something look wrong hmm |
Should be fixed, @PabstMirror |
I think we should use the debug in this PR to figure out what PFH is added more than a million times in missions running longer than 4 hours. Maybe we can fix that (if it's a PFH in ACE) and we don't need to change the handles at all. |
I agree - the debug printout should be useful in identifying the PFH overruns |
Fix issues with PerFrameHandlers
ref: #229, #230
FUNC(onFrame)
to reduce overheadI'm currently on 1.55 dev and there seems to be no array size limit, so I can't really test #229.