I know that Fusion's had lots of optimisation improvements over the years, which is why I was surprised by some recent tests I did using the A/B tester in VACCiNE (which, as far as I can tell, is reasonably accurate).
See these two comparisons. Since the events in the one on the left are adjacent and have identical conditions, I assumed that the Fusion compiler would consolidate them, resulting essentially in the single event on the right. It seems like an obvious optimisation to make (and I'm sure the compiler contains much cleverer and more intricate optimisations than that). Yet, as you can see in the test results, the right version performs 32% better (I ran the test multiple times to make sure)
I sometimes split up events (as on the left) because it makes the code easier to read (and you can place comments in between particular sections). And I've just assumed that it didn't make any performance impact. Do you think the 32% above is because these use fastloops, or do you think that all types of events would suffer a similar performance decrease when split up?
Now, some of you may have noticed that these tests used a fastloop that was run 700000 times per frame with the left events causing a performance drop of 24ms, and you might ask: "so what? Isn't that such a tiny drop that it's not worth even considering?" The answer to that is, of course: yes it is :-) ....though perhaps not quite as microsopic as you might think. Humour me:
24ms per 700000 loops is 0.00003428571ms per single loop. That is indeed tiny! But my CPU is pretty fast (core i7 4770k). What about if we ran this code on an older laptop with a weaker CPU? We could feasibly imagine it taking twice as long to do these operations. Assuming it still had a 32% discrepancy between both events, we might then get a 48ms drop, or 0.00007ms per single loop. Now, let's imagine that we're running a full game that has many of these 'split events' throughout its code, including inside fastloops and foreach loops. Without too much stretching of plausability, we could imagine that the game had 100 such 'split events', which would accumulate to 0.007ms per single loop.
Now, let's say we're running this game connected to a 144Hz monitor, that runs 144 frames per second. There are 1000 ms in a second, which means that for a smooth 144fps, each frame must be completed in 6.9ms or less. But, because of our performance drop of 0.007ms, we now have a diminished time limit: we now only have 6.893ms to complete each frame. This is................still really tiny. OK, you win :P