Closed DavyLandman closed 5 years ago
okay, after writing this PR, I realized there is a different way to achieve it, without the extra wrapped set. I think this is a better approach now.
note that the MultimapResultImpl is also allocated a lot (10GB), but since it's an mutable object, it's harder to share. Maybe if we made it immutable, it would be easier to avoid all the allocations of unchanged().
In the last commit I replaced the EnumSet
with a int that uses the bits to flag if an enum is set. So no more extra allocations for the EnumSet
s.
Thanks!
After profiling a phase of the rascal bootstrap, I saw that there were 20GB of allocation of the
EnumSet.noneOf()
empty EnumSets. So I changeMultimapResultImpl
to keep around a single instance of the set to avoid the allocations of it. All test still run correctly, so thats a postive sign.The only global effect is that I've changed the interface to
Set
, such that I can put the sharedEnumSet
unside anImmutableSet
wrapper.note that the
MultimapResultImpl
is also allocated a lot (10GB), but since it's an mutable object, it's harder to share. Maybe if we made it immutable, it would be easier to avoid all the allocations ofunchanged()
.btw, is master the right branch to release this from?