It's interesting how most of the optimizations are only really available if you essentially write your programs in a functional style. That is, they all depend on the compiler being able to analyse the local scope to decide whether the state changes are confined enough that it can perform an optimization without changing behavior. If a reference escapes, even into a private, instance variable, the compiler will (admittedly, only based on the shallow analysis in this article), more or less give up, because it can't predict any more how that variable might be mutated from another scope.