[GHC] #8474: Extremely slow compilation of a program with multiply implicit parameters
#8474: Extremely slow compilation of a program with multiply implicit parameters -------------------------------------------+------------------------------- Reporter: akamaus | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: -------------------------------------------+------------------------------- Adding yet another ?tstX variable in this snippet slows down compilation by a factor of ten or so. Giving an explicit type annotation to tst1 makes compilation instant. {-# LANGUAGE ImplicitParams #-} data D = D Int deriving Show slow_to_compile :: IO () slow_to_compile = do tst1 <- return 1 let ?tst1 = tst1 let ?tst2 = tst1 let ?tst3 = tst1 let ?tst4 = tst1 let ?tst5 = tst1 let ?tst6 = tst1 let ?tst7 = tst1 print $ D ?tst1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8474> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8474: Extremely slow compilation of a program with multiply implicit parameters --------------------------------------------+------------------------------ Reporter: akamaus | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Old description:
Adding yet another ?tstX variable in this snippet slows down compilation by a factor of ten or so. Giving an explicit type annotation to tst1 makes compilation instant.
{-# LANGUAGE ImplicitParams #-}
data D = D Int deriving Show
slow_to_compile :: IO () slow_to_compile = do tst1 <- return 1
let ?tst1 = tst1 let ?tst2 = tst1 let ?tst3 = tst1 let ?tst4 = tst1 let ?tst5 = tst1 let ?tst6 = tst1 let ?tst7 = tst1
print $ D ?tst1
New description: Adding yet another ?tstX variable in this snippet slows down compilation by a factor of ten or so. Giving an explicit type annotation to tst1 makes compilation instant. {{{ {-# LANGUAGE ImplicitParams #-} data D = D Int deriving Show slow_to_compile :: IO () slow_to_compile = do tst1 <- return 1 let ?tst1 = tst1 let ?tst2 = tst1 let ?tst3 = tst1 let ?tst4 = tst1 let ?tst5 = tst1 let ?tst6 = tst1 let ?tst7 = tst1 print $ D ?tst1 }}} -- Comment (by simonpj): Yes, you're right. We'll fix this! Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8474#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8474: Extremely slow compilation of a program with multiply implicit parameters --------------------------------------------+------------------------------ Reporter: akamaus | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"54717c8218cb27b1f1f56ba019c17494556f766c/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="54717c8218cb27b1f1f56ba019c17494556f766c" Be more careful when iterating the constraint-simpifier loop (fixes Trac #8474) We were (uselessly) iterating the simplification loop an exponential number of times. Lovely simple test case showed this up. See Note [Cutting off simpl_loop] in TcSimplify }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8474#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8474: Extremely slow compilation of a program with multiply implicit parameters --------------------------------------------+------------------------------ Reporter: akamaus | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"04f6ddd0e56fd21a399d17634533dfaf89b25773/testsuite"]: {{{ #!CommitTicketReference repository="testsuite" revision="04f6ddd0e56fd21a399d17634533dfaf89b25773" Test Trac #8474 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8474#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8474: Extremely slow compilation of a program with multiply implicit parameters -------------------------------------------------+------------------------- Reporter: akamaus | Owner: Type: bug | Status: Priority: normal | closed Component: Compiler (Type checker) | Milestone: Resolution: fixed | Version: 7.6.3 Operating System: Unknown/Multiple | Keywords: Type of failure: None/Unknown | Architecture: Test Case: | Unknown/Multiple typecheck/should_compile/T8474 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Changes (by simonpj): * status: new => closed * testcase: => typecheck/should_compile/T8474 * resolution: => fixed Comment: Terrific example, very insightful, thank you. Now fixed. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8474#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC