# Optimizations

The compiler performs optimizations to make sure that all formulas run as fast as possible. It is helpful to know something about these optimizations when writing formulas.

The optimizations can be divided into two categories:

• Evaluation of constant expressions. Constant expressions are expressions whose value can be evaluated by the compiler. Constant expressions can contain operators, built-in functions, constants and parameters. This is possible because the formula is re-compiled each time a parameter changes, so parameters can be treated as constants by the compiler.
• Replacement of slow operations by faster ones, such as replacing 2*x by x+x (adding is faster than multiplying).

When writing formulas, this has the following consequences:

• Writing to parameters is not recommended. This can make the formula run slower, because parameters cannot be treated as constants anymore.
• You can write constant expressions wherever you want. You do not have to precalculate them, because the compiler can do that for you. So, using 2 + 1/3 is just as fast as using 2.3333. Just use whatever you find most convenient.
• If statements with constant expressions (like if 3 < 2) are completely eliminated by the compiler. This is very helpful when you use lots of if statements depending on the values of enumerated parameters. Therefore making your formula versatile by providing many options does not cause it to run slower.
• You can use descriptive operators like z^4 instead of z*z*z*z or sqr(sqr(z)), since Ultra Fractal automatically chooses the most efficient operation independent of the operators or functions used.

Next: Compatibility