[GHC] #8174: GHC should not load packages for TH if they are not used

#8174: GHC should not load packages for TH if they are not used -------------------------+------------------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: | Milestone: 7.8.1 normal | Version: 7.6.3 Component: | Operating System: Unknown/Multiple Compiler | Type of failure: Compile-time performance bug Keywords: | Test Case: Architecture: | Blocking: Unknown/Multiple | Difficulty: | Unknown | Blocked By: | Related Tickets: | -------------------------+------------------------------------------------- https://github.com/nh2/ghc-bug-th-loading When you call {{{ ghc --make -package mypackage }}} on a module that uses TH, you will see {{{ Loading package mypackage-1.2.3.4 ... linking ... done. }}} even if no code uses it. This slows down builds, especially cabal ones. GHCI does this better and only loads what is needed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8174 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8174: GHC should not load packages for TH if they are not used -------------------------------------------------+------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time performance bug | Unknown/Multiple Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by hvr): fwiw, when I call `ghci -package vector`, it gets loaded eagerly too: {{{ $ ghci -package vector GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package array-0.4.0.1 ... linking ... done. Loading package deepseq-1.3.0.1 ... linking ... done. Loading package primitive-0.5.0.1 ... linking ... done. Loading package vector-0.10.0.1 ... linking ... done. Prelude> }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8174#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8174: GHC should not load packages for TH if they are not used -------------------------------------------------+------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time performance bug | Unknown/Multiple Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by nh2): Hmm, you are right. I wonder from what I got the impression that GHCI didn't do this. Still, do you think it is possible to make them load the packages lazily, when needed? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8174#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8174: GHC should not load packages for TH if they are not used -------------------------------------------------+------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time performance bug | Unknown/Multiple Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by ezyang): In some sense, GHCi is already loading the packages semi-lazily; GHC won't resolve any objects until you actually attempt to use an object. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8174#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8174: GHC should not load packages for TH if they are not used -------------------------------------------------+------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time performance bug | Unknown/Multiple Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by nh2): Replying to [comment:3 ezyang]:
In some sense, GHCi is already loading the packages semi-lazily; GHC won't resolve any objects until you actually attempt to use an object.
What does "resolving objects" mean? Could you elaborate a bit? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8174#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8174: GHC should not load packages for TH if they are not used -------------------------------------------------+------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time performance bug | Unknown/Multiple Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by ezyang): Sorry, it looks like I was mistaken. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8174#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8174: GHC should not load packages for TH if they are not used -------------------------------------------------+------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time performance bug | Unknown/Multiple Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by akio): #2437 and #3560 seem to be related to this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8174#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8174: GHC should not load packages for TH if they are not used -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.6.3 Resolution: duplicate | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: Compile- | Blocked By: time performance bug | Related Tickets: #2437 Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * resolution: => duplicate * related: => #2437 Comment: This seems to be covered by #2437. I added a link back to this ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8174#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC