pragma strict on iOS: if no errors does it improve anything?

I’ve been adding #pragma strict to scripts & never get any errors.

Guess I’m doing things right?

Anyways just curious if it is still invisibly doing wonderful things to my code with the “static typing”, is adding #pragma strict actually improving the code in these cases where there is no errors?

The #pragma in itself doesn’t improve the performance (it is not a compiler flag such as -O3 on GCC). But the fact that your code respect the #pragma strict ensure that the code works better because the runtime does not need to guess the type of each variable (amongst other improvement).

In conclusion a script that pass the #pragma strict is most of the time faster than a script that don’t, easier to debug and less error-prone.

When the build platform is iOS, all JS scripts are compiled with #pragma strict anyway, so adding it manually does nothing. And no it doesn’t improve code, all it does is prevent dynamic-typed code from compiling.