Invariant Code Optimization
Invariant code optimization is best illustrated by example. Assume you have the following code:
The expression 1+2+3+4; is normally executed 1000 times. However, each time this expression is evaluated, it returns the same result. Therefore, you can rewrite the code as follows:
There is no need for you to optimize your code manually in this way because DScript performs this optimization automatically at runtime.