Optimization Levels Explained

May 30, 2026 | 5 min read

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

ScenarioRecommended Level
CI / rapid testing0 or 1
Staging / QA2
Production3
Debugging compiler crashes0