- Mar 5, 2021
- Reaction score
- First Language
- Primarily Uses
These kind of microoptimizations don't affect you in the slightest. The question I would ask is what gives better readability and is easier to modify. Personally, I prefer the second one in this case. You can add a Comment to each line explaining which event you are switching on, add new ones with a simple copy&paste and if you for some reason need to make one of them conditionally dependent you can easily integrate an if.
In the grand scheme of thing it shouldn't make any significant difference to the computer. The real efficiency question is which one takes less devtime for you.
read what I wrote aboveIn certain specific scenarios, every frame counts, so I'm wondering if my first example gets processed faster (even if just by a single frame) than the second example.
If you noticed ANY frame difference at all, you should look at other factors and not this one.I didn't expect that it would generally make any noticeable difference performance-wise, but I'm wondering if it makes ANY difference at all. In certain specific scenarios, every frame counts, so I'm wondering if my first example gets processed faster (even if just by a single frame) than the second example.