Share nullary TyConApps
While looking at ticky profile of I have noticed that GHC allocates a great deal of types of the form TyConApp tycon []
. In #17958 (closed) we optimised the specific case of liftedTypeKind
, but profiles suggest that other types may also benefit from this treatment. The idea here is that we would modify TyCon
to carry such a nullary TyConApp
which would be used by mkTyConTy
and mkTyConApp tc []
. This helps compiler performance in a few ways:
- we avoid allocating, eliminating code and reducing GC pressure
- we reduce residency, lowering GHC's memory footprint and reducing cache pressure