[GHC] #15652: SerializedCompact has a [(Ptr a, Word)] instead of a custom datatype

#15652: SerializedCompact has a [(Ptr a, Word)] instead of a custom datatype -------------------------------------+------------------------------------- Reporter: chessai | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: | Version: 8.4.3 libraries/compact | Keywords: ghc-compact, | Operating System: Unknown/Multiple compact regions | Type of failure: Runtime Architecture: aarch64 | performance bug Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{#!hs 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 {{{#!hs 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 {{{#!hs data SerializedCompact a = SerializedCompact { serializedCompactBlockList :: [CompactBlock a] , serializedCompactRoot :: Ptr a } }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15652 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15652: SerializedCompact has a [(Ptr a, Word)] instead of a custom datatype -------------------------------------+------------------------------------- Reporter: chessai | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: | Version: 8.4.3 libraries/compact | Keywords: ghc-compact, Resolution: | compact regions Operating System: Unknown/Multiple | Architecture: aarch64 Type of failure: Runtime | Test Case: performance bug | Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (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? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15652#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15652: SerializedCompact has a [(Ptr a, Word)] instead of a custom datatype -------------------------------------+------------------------------------- Reporter: chessai | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: | Version: 8.4.3 libraries/compact | Keywords: ghc-compact, Resolution: | compact regions Operating System: Unknown/Multiple | Architecture: aarch64 Type of failure: Runtime | Test Case: performance bug | Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15652#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC