While investigating #12420 I noticed that one particular part of our optimizer seems quadratic for very large nested expressions made of nothing but function/method applications, e.g. M(M(M(M.....)))) and the kind of code that comes out of computation expressions.
The problem is already noted in our code, see permalink
This isn't critical but we should fix this sometime. It appears to be re-traversing expressions determining free variables.