Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Optimization Passes

Script optimization is performed via multiple passes. Each pass does a specific optimization.

The optimization is completed when no passes can simplify the AST any further.

Built-in Optimization Passes

PassDescription
Dead code eliminationEliminates code that cannot be reached
Constants propagationReplaces constants with values
Compound assignments rewriteRewrites assignments into compound assignments
Eager operator evaluationEagerly calls operators with constant arguments
Eager function evaluationEagerly calls functions with constant arguments