`Bug` Quadratic(?) compiler perf for huge nested expressions
Open
Area-Compiler-Optimization
Feature Improvement
Theme-Performance
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
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](https://github.com/dotnet/fsharp/blob/f0f9c17aa45ca963bd8bf69ce7c72883e4dafc3f/src/fsharp/Optimizer.fs#L2541-L2543)
This isn't critical but we should fix this sometime. It appears to be re-traversing expressions determining free variables.
Contributor guide
Assessment
This issue has not been assessed yet.