Lack of sharing in `GHC.Types.Demand`
Similarly to #17292 (closed) there is quite a lot of redundant allocation in
GHC.Types.Demand of identical demands.
Two which I immediately saw in the profile:
-- 320 000 allocations of this demand which is equal to `nopDmdType` ghc:GHC.Types.Demand:DmdType[containers-0.6.4.1:Data.IntMap.Internal:Nil,ghc-prim:GHC.Types:,ghc:GHC.Types.Demand:Dunno] -- 150 000 allocations of this demand which is equal to `poly0N` ghc:GHC.Types.Demand:Poly[ghc:GHC.Types.Demand:C_0N]
We should try and make sure we reuse the CAF as much as possible to save allocations and GC pressure.
In general, perhaps we should think of doing some limited hash consing in the RTS, there are probably a lot of applications which end up with a similar problem.