Variable or swithces? Best practice advice focused on performance.

So, let's assume I wanna make a system that will decide something, according to some things that occur.

Let's say we got 11 Events.

There might be 3 things possibly happening to each of them. 

What happens to the first, will determine what happens on the second. What happens on both first and second will determine the third and so on till let's say 11.

A lot of complex calculations is going on. 

Since it is three things that can happen, I can have either 11 variables with conditional branches for value 1, 2, else.

On the other hand, I can use 33 switches to determine what will happen.

Consider spaghetti code not significant.

Consider 33 switch hardship and complexity not significant.

What will be the best approach to make this, to retain as much performance as possible?

33 Switches or 11 variables?
The smaller code will be the faster one.
Variables then. 🙂 Thanks.
If they happen in a fixed order of succession, you might even be able to use a single variable..
Don't worry about performance decrease on storing switches and variables. Unless you are using millions you won't see any difference, and even then millions might work just fine.

What matters is the event code. How many event commands must be processed.

My suggestion is to go for the simplest solution first.

Could be easily fast enough. You can show use what you end up with. Makes it much easier for us to give you hints.

*hugs*

 - Zeriab

Original thread: https://forums.rpgmakerweb.com/threads/variable-or-swithces-best-practice-advice-focused-on-performance.42564/