[GHC] #12754: Adding an explicit export list halves compilation time.

GHC ghc-devs at haskell.org
Sat Oct 22 17:55:36 UTC 2016


#12754: Adding an explicit export list halves compilation time.
-------------------------------------+-------------------------------------
           Reporter:  mpickering     |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 A file only containing a 10000 constructor enumeration type compiles twice
 as fast with an explicit export list compare to having no export list.

 {{{
 # print "module A where"
 print "module A (T ( .. ) ) where"
 print "\n"
 print "data T = C"
 for i in range(0,10000):
     print ("    | C" + str(i))
 }}}

 Without an export list:

 {{{
 [1 of 1] Compiling A                ( A.hs, A.o )

 real    0m22.872s
 user    0m19.653s
 sys     0m0.868s
 }}}

 With the export list:

 {{{
 [1 of 1] Compiling A                ( A.hs, A.o )

 real    0m11.249s
 user    0m10.428s
 sys     0m0.435s
 }}}


 The culprit here is `exports_from_avail`, in the case that no export list
 is provided, the things to export
 are gathered from the `GlobalRdrEnv`. Each constructor is placed in its
 own `Avail` which are then combined by `plusAvail` which is implemented
 using the expensive `unionLists`.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12754>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list