I just had a quick performance related question about the event system: do the conditions on an event "early out"?
Say for example I have an event triggered by the following conditions:
- MouseClick on Sprite
- if someVariable = true
- if someOtherVariable = true
So logically, the event triggers when the mouse is clicked on a sprite object if someVariable and someOtherVariable are both true.
If someVariable is false in my example, would construct bother to check the value of someOtherVariable, or will it be clever enough to early-out and skip that check?
I ask because I have a couple of events with reasonably complicated conditions and I'm wondering if I should bother arranging the conditions in an order that could take advantage of an early-out to skip un-needed checks.
I am aware that the performance impact would be fairly minimal, and that where possible it's better to design less complicated events or break things down to sub-events anyway, but small differences can add up on a mobile platform and I'd like to know if this is an area worth spending (and admittedly minimal amount of) effort on?
Lastly, if conditions don't
early-out, consider this a suggestion that if it is not overly difficult to make them do so they should!
Thanks for your time!