Skip to content

IfaceToType: Ensure that IfaceTyConInfo is shared

Andreas Klebinger requested to merge wip/T19194 into master
IfaceToType: Ensure that IfaceTyConInfo is shared

In #19194 mpickering detailed that there are a LOT of allocations
of IfaceTyConInfo:

There are just two main cases: IfaceTyConInfo IsPromoted IfaceNormalTyCon
and IfaceTyConInfo NotPromoted IfaceNormalTyCon. These should be made into
CAFs and shared. From my analysis, the most common case is
IfaceTyConInfo NotPromoted IfaceNormalTyCon (53 000)
then IfaceTyConInfo IsPromoted IfaceNormalTyCon (28 000).

This patch makes it so these are properly shared by using a smart
constructor.

Fixes #19194.

Merge request reports