binary
binary copied to clipboard
Deserializing many TypeReps may lead to high residency
Deserialized TypeReps don't share any structure with each other, which can potentially waste a lot of space. For example, if I fill a giant Set with deserialized Dynamic values, the lion's share of the space could be taken up by the TypeReps. One potential fix would be to maintain weak tables holding deserialized TyCons and TypeReps. We could use one of type Map Fingerprint (exists a. Weak (TypeRep a)) and one of type Map Fingerprint (Weak TyCon), but other sorts of maps would probably be faster. When a (perhaps recursively) deserialized TyCon or TypeRep matches one stored in the table, it would be thrown away in favor of the stored one.