It optimizes with knowledge of data flow history and code path transversal. A few passes of data and it can rewrite your core hot spots. CPUs just got fast enough that this type of optimization is possible in real time and people don't get annoyed by the initial "sluggish" moment while the overhead of the optimizer tanks the system.