Does the engine checks "if" statments in order?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DwarvenTrader

This is a “performance” related question.

Le’ts say I have around 50 instances running around, checking 3 different conditions every frame, will the second code be faster than the first one?

func _process(delta):
    if Something_Common and Something_That_Is_Rare and Something_SUPER_rare:

func _process(delta):
     if Something_SUPER_rare and Something_That_Is_Rare and Something_Common:

In other other words, should I ask the engine to check the rarest condition first so he can move on, instead of going all the way every single frame?

:bust_in_silhouette: Reply From: HalfTough

I’m not 100% sure about Godot but every programming language I know of does this.

So yeah, putting them in order from rarest to most common makes sense (or not if checking rarest one would take much longer than the rest).