Opened 3 years ago

Last modified 3 years ago

#12896 new feature request

Consider using compact regions in GHC itself to reduce GC overhead

Reported by: rwbarton Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.0.1
Keywords: Cc: niteria
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


In make mode, GHC keeps a lot of in-memory data structures about modules it has built and interface files it has read. These data structures are long-lived and immutable (at least, per module/mutually recursive module group/package), so they may be candidates for storing in compact regions to reduce the work done by the GC.

Potential problem: if we rely heavily on lazy evaluation in these structures for the purpose of avoiding work that will never be needed, then we can't store them in a compact region (since the contents of a compact region must be fully evaluated).

Change History (2)

comment:1 Changed 3 years ago by niteria

Cc: niteria added

comment:2 Changed 3 years ago by simonmar

I actually tried using it for interface files, but it won't work (yet). We can't compact pinned memory, and FastString is implemented in terms of ByteString, which is backed by pinned memory. Perhaps we ought to special-case this somehow, because compacting things involving ByteString would be really useful - it would be possible but we have to adjust the address stored in the ByteString when we copy it. (or fix ByteString to use unpinned memory, which we want to do anyway, but that's harder).

Also I'm not 100% sure that there aren't functions buried somewhere in ModIface, which also can't be compacted.

Note: See TracTickets for help on using tickets.