compact regions: Add a hash-consing variant
There are currently two ways to compact an object.
- Normal way, don't share anything.
- Sharing preserving, preserve existing sharing
It has been discussed a few times about adding another variant which performs hash-consing when adding closures into the compact. Typically there are can be a lot of identical allocated closures which are not shared so putting them into a compact and hash-consing them could be a good way to reduce the memory footprint of an application.
One particular example of this happening in GHC is there are many identical TyConApp nodes allocated in memory as no special effort is made to introduce sharing except for a some special cases.