Opened 14 months ago

Last modified 11 months ago

#15652 new bug

SerializedCompact has a [(Ptr a, Word)] instead of a custom datatype

Reported by: chessai Owned by: ezyang
Priority: normal Milestone: 8.10.1
Component: libraries/compact Version: 8.4.3
Keywords: ghc-compact, compact regions Cc: ezyang, andrewthad
Operating System: Unknown/Multiple Architecture: aarch64
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


data SerializedCompact a = SerializedCompact
  { serializedCompactBlockList :: [(Ptr a, Word)]
  , serializedCompactRoot :: Ptr a

I'm not sure why the first member of SerializedCompact isn't something like

data CompactBlock a = CompactBlock {-# UNPACK #-} (Ptr a) {-# UNPACK #-} Word

so the Ptr can unpack into the constructor, which isn't possible with (,). SerializedCompact would then look like

data SerializedCompact a = SerializedCompact
  { serializedCompactBlockList :: [CompactBlock a]
  , serializedCompactRoot :: Ptr a

Change History (3)

comment:1 Changed 14 months ago by bgamari

I don't think there's any deep reason for this; it was likely just the most convenient choice at the time the code was written. Ultimately it seems unlikely that there will typically be enough blocks that unpacking will have a significant change in performance characteristics. Is there a particular motivation for wanting unpacking here?

comment:2 Changed 14 months ago by chessai

You're probably right about the significant change in performance, though I aim for unpacking everywhere - it just seems to be a better default mindset overall.

comment:3 Changed 11 months ago by osa1


Bumping milestones of low-priority tickets.

Note: See TracTickets for help on using tickets.