Two optimization questions (Parallel processes and scripts)

Hi,
This time I have 2 more general questions about how the game engine works.

1) From a performance point of view: is it always better to run the game processes in a single flow or, sometimes, to divide the internal processes into a parallel process?
A more concrete example: suppose a dialogue.
At a certain moment the player must make a choice that, through a filter, makes things happen in the game world according to the choice made.
Suppose this filter is a veeery long common event, full of conditional branches and scripts.
Which of the two structures is better?

catturapost.PNG


(I know that too many simultaneous parallel processes, mostly if not well structured with wait commands, can be heavy, but in this case we only suppose the one activated by the switch).

2) How much can the use of script calls in common events actually affect performance? I have seen that Yanfly has even created a plugin called "Optimize script calls", are they really that heavy? Any tips on how to best use them?
Hi there!
About your two structures, I think that it doesn't matter A or B. The performance will rely on how you made the events.
If it is only two events, you will be fine. Things can get ugly if you use a lot of parallel events at the same time, I mean, a lot!
I had an experience with my old computer, with 47 parallel events on the map, and had no lag. But it will always depend on how you made it.
Try to think about the "readability" of your event. If it is easy to read because you can fix bugs more easily that way.

About the script call, it uses a process called "eval" which is a function in javascript to execute codes. The problem is that eval is an expensive function in javascript, but it also is really fast(not so fast if you execute the code in another way, like plugin commands).
But a lot of people alert for we (coders) try to avoid using it.
Depend on the code you execute you can get some lag or not(it will also depend on the PC of the user too).
I had an experience using script calls to show pictures that I had a delay of 2 seconds in command. But with the event command, I did not have this delay.
So if you can avoid, avoid use script calls. But in most cases, you should be fine using it.

The yanfly plugin optimizes the script calls only in common events, but I'm really not sure how he/she did it or how it performs in Mv.

Original thread: https://forums.rpgmakerweb.com/threads/two-optimization-questions-parallel-processes-and-scripts.120804/