-
Notifications
You must be signed in to change notification settings - Fork 231
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
Query regarding MediatorState - Objects Loop Performance #267
Comments
I think I did the modification of that loop while working with killing objects and adding that "removeImmediately" function and so on. There might be other implications such as one object killing or removing an object immediately inside its update function I guess with the new insertAt() removeAt() though, which I have not tried yet, the entire MediatorState update loop could change completely. Feel free to suggest an entire new loop though that we could discuss though, We didn't focus on that crucial part of the engine for a while obviously |
Understood, I don't see the .removeAt function on the _objects vector o0.. but I do on the garbage array, was this not added to both according to the release notes of AIR 19? |
Right, unfortunately, I'm not as talented as the team, or my friend that added a couple extra lines to what I was suggesting, and the end result was this:
I may of lied about how the garbage collection worked to him, can you answer his question? ^^ "TailBit: in this I only cut them out of the object array when they are added to garbage, that means that the array only need to change on kill and can stay unchanged when they should remain alive" The performance difference, is incredible, if this patch is doing the exact same thing, we're talking from 0.5fps with a potential halt to 17fps.. for 2000 objects |
I think this is what the code looked like before, with the splice. anyway yes garbage is empty after update is done because of this line |
you can see here the old version of the update loop : |
Oh and I remember now why the loop looks like that : As you may see here, we use _numObjects for the loop |
How important is the implementation of:
object = _objects.shift();
_objects.push(object);
rather than just:
object = _objects[ i ];
( in the update function )
I thought I'd ask first, I've found the bottom one liner plus commenting out the push, at least 20% faster, but this could come off me being really silly, if you have a really important reason for sorting the objects.. like perhaps, groups do not work properly from the one liner way.
I haven't tested killing yet, but yeah, just curious about the implementation really, and it's purpose that I may not be seeing.
The text was updated successfully, but these errors were encountered: