Hello forum folks,
This is probably a beginner question. It is about code optimization.
I have a function that I only sometimes want to be called. This is done now through a long line of code. It is an IF statement with about 8 conditions in the physics_process.
My question: Is it faster to have an IF statement with just one bool to be checked? This bool will only allow access to check up on another IF statement (with the other 7 conditions) when there is a reason to so (which is not so often). Wouldn't this save the computer a lot of calculations within the physics_process as long as this bool remains false?
If this is not the case, I think I'd prefer to use the long 8 conditions IF statement.