3 ms·
I'm finding it impressive that the compilers even attempt to implement this optimization.
by jhallenworld 8y ago
I'm finding it impressive that the compilers even attempt to implement this optimization.
- gsnedders 8y agoIt's not that hard to roughly approximate: does an enclosing scope reference this variable or does an enclosing scope contain a direct eval call? (You also have cases where you don't know for sure, especially in the presence of the with statement, but then you just assume it is referenced.) If no enclosing scope references or maybe references it, you can treat it differently to those that are referenced. You don't even need to do actual escape analysis to get 99% of the cases.