typeKind is quadratic
While pondering D3998, I realized that any computation of a type's kind should be careful in the presence of nested AppTy
s. And, to my horror, I realized that GHC's very own typeKind
isn't! That is, if you have the type a b c d e
, GHC will take a quadratic (or worse -- haven't benchmarked) amount of time computing its kind.
This can be easily fixed by looking for nested AppTy
s and using piResultTys
, instead of repeated uses of piResultTy
(as is currently done).
NB: This was not discovered through witnessing poor performance, but it does seem like very low-hanging compiler-performance fruit.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Task |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |