[GHC] #8474: Extremely slow compilation of a program with multiply implicit parameters

GHC ghc-devs at haskell.org
Thu Oct 24 15:13:35 UTC 2013


#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


More information about the ghc-tickets mailing list