Does amount of Events impact speed?

Post » Wed Apr 19, 2017 10:33 pm

Depending on the particular event, it can, or it might not. There is no solid answer. A single event running physics or pathfinding on a ton of objects may cause more impact than a thousand empty events.

That is why the best answer is to test it and see. If you can't benchmark/measure any significant difference, then it isn't worth worrying about.

If you want a straight answer, I'll give you an unofficial one - No, number of events or sub events does not impact speed. You're welcome to show me a specific case where it does, and I will say you're right, but most likely it is a case already covered in https://www.scirra.com/blog/83/optimisa ... -your-time.

And if you don't trust Scirra for some reason here are other articles to read. It is common advice across all platforms.
http://www.flounder.com/optimization.htm
http://www.joshbarczak.com/blog/?p=580
http://wiki.c2.com/?PrematureOptimization

Basically it comes down to this: If you can't tell for certain yourself if it makes a difference, and you are unable to create a situation where you are able to tell it does make a difference, and end up having to ask someone else if it does or not... then the information is of absolutely no practical use.

Edit: As for what really does matter, in terms of deciding how to organize your events, is readability and how the events fit together logically (your own logic). I might be able to combine 10 events down to 1, but it will take a lot of effort and if I need to change anything later it might be a pain. It might also be harder to remember what I was going for in the first place.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Wed Apr 19, 2017 11:31 pm

Yes it does matter, if you're doing something like using the same conditions over and over.

Example:

Event 1 - Bullet is overlapping wall, turn on particle effect

Event 2 - Bullet is overlapping wall, play sound

Event 3 - Bullet is overlapping wall, destroy.

Doing something stupid as that is going to be 3 times heavier than just putting all the actions under the same condition. Above example will check overlap 3 times. Every time you use the same condition again it has to check for it again. So it's generally better to use less conditions like:

Event 1 Bullet is overlapping wall, turn on particle effect, play sound, destroy.

Much better than checking same conditions over and over, like above example.
Follow my progress on Twitter
or in this thread Archer Devlog
B
38
S
15
G
17
Posts: 949
Reputation: 12,320

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests