guides
Optimization Levels Explained
What each optimization level (0-3) does and when to use them.
Published May 30, 2026
Level 0 — No Optimisation
Fastest compile time. Minimal optimisations. Use for development and rapid iteration.
pyvorin run script.py --opt-level 0
Level 1 — Basic Optimisation
Dead code elimination, constant folding, and simple inlining. Good balance for testing.
Level 2 — Aggressive Optimisation
Loop unrolling, vectorisation hints, and type-specialised paths. Recommended for production.
Level 3 — Maximum Optimisation
Full interprocedural analysis, aggressive inlining, and stack allocation of primitives. Longest compile time, fastest runtime. Default.
pyvorin run script.py --opt-level 3
When to Change Levels
| Scenario | Recommended Level |
|---|---|
| CI / rapid testing | 0 or 1 |
| Staging / QA | 2 |
| Production | 3 |
| Debugging compiler crashes | 0 |