[GHC] #14337: typeRepKind can perform substantial amounts of allocation

#14337: typeRepKind can perform substantial amounts of allocation -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Core | Version: 8.2.1 Libraries | Keywords: Typeable | Operating System: Unknown/Multiple Architecture: | Type of failure: Runtime Unknown/Multiple | performance bug Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I came up with a (rather contrived) test case to demonstrate that Phab:D4082 reduced big-O time complexity in pathological cases. But I expected it to increase space usage by a constant factor. What I found was very much the opposite: it dramatically reduced allocation. The reason for this is obvious in hindsight. Every time we call `typeRepKind`, we recalculate the kind entirely from scratch. That recalculation is only a potential ''time'' problem for `TrApp`, because we only need to walk down links, but it's also a ''space'' problem for `TrTyCon`, because we're building up a `TypeRep` from a `KindRep`. The solution, assuming we choose to keep `typeRepKind`, seems fairly clear: whether or not we choose to cache the kind in `TrApp`, we should almost certainly do so in `TrTyCon`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14337 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14337: typeRepKind can perform substantial amounts of allocation -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Core Libraries | Version: 8.2.1 Resolution: | Keywords: Typeable Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Is this something to do with #14254, perhaps?
I came up with a (rather contrived) test case
Did you perhaps fail to attach it? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14337#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14337: typeRepKind can perform substantial amounts of allocation -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Core Libraries | Version: 8.2.1 Resolution: | Keywords: Typeable Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: #14254 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by dfeuer): * related: => #14254 Comment: I've attached it now, to #14254. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14337#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC