#12367: Commit adding instances to GHC.Generics regression compiler performance -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Generics Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * cc: ezyang (added) Comment: Great catch! This is all Edward's fault :-). {{{ commit 4c834fdddf4d44d12039da4d6a2c63a660975b95 Author: Edward Z. Yang <ezyang@cs.stanford.edu> Date: Mon Nov 17 21:23:52 2014 -0800 }}} The `is_dfun` field of a `ClsInst` should be lazy, only pulled on if the instance is actually needed. See the `forkM` in `TcIface.tcIfaceInst`. But this `instIsVisible` stuff is pulling on the `is_dfun` which forces lots of stuff to get loaded that is entirely unnecessary. Solution: add an `is_mod :: Module` field to `ClsInst`, which gives the `Module` for the `ClsInst`. Invariant: it's the same Module as that for the `is_dfun`. And use that `is_mod` field in `instIsVisible`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12367#comment:15> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler