[GHC] #9400: poor performance when compiling modules with many Text literals at -O1

GHC ghc-devs at haskell.org
Sun Aug 3 14:39:38 UTC 2014


#9400: poor performance when compiling modules with many Text literals at -O1
-------------------------------------+-------------------------------------
       Reporter:  rwbarton           |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.3
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:  Compile-
     Blocked By:                     |  time performance bug
Related Tickets:  #9370              |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 (Spawned from #9370; see there for original discussion)

 Unpack the xmlhtml package and edit `src/Text/XmlHtml/HTML/Meta.hs` and
 remove the `OPTIONS_GHC` line at the top of the file that disables
 optimizations and build with `cabal buidl`. Then GHC takes ~1.5GB and over
 a minute to build this single module.

 Preliminary investigation indicates that Text's fromString and its
 constituent parts is being inlined repeatedly:
 {{{
 Inlining done: Data.String.fromString
 Inlining done: Data.Text.$fIsStringText
 Inlining done: Data.Text.pack
 Inlining done: Data.Text.Internal.Fusion.unstream
 Inlining done: Data.Text.Internal.Fusion.Common.map
 Inlining done: Data.Text.Internal.Fusion.Common.streamList
 Inlining done: Data.Text.Internal.safe
 Inlining done: Data.Bits.$fBitsInt_$c.&.
 Inlining done: Data.Text.Internal.Fusion.Types.$WYield
 [ repeats ~4000 times ]
 }}}
 resulting in a very large intermediate program:
 {{{
 *** Checking old interface for xmlhtml-0.2.3.2:Text.XmlHtml.HTML.Meta:
 [ 1 of 10] Compiling Text.XmlHtml.HTML.Meta (
 src/Text/XmlHtml/HTML/Meta.hs, dist/build/Text/XmlHtml/HTML/Meta.o )
 *** Parser:
 *** Renamer/typechecker:
 *** Desugar:
 Result size of Desugar (after optimization)
   = {terms: 26,260, types: 20,021, coercions: 0}
 *** Simplifier:
 Result size of Simplifier iteration=1
   = {terms: 1,446,658, types: 953,432, coercions: 314,352}
 ...
 }}}

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


More information about the ghc-tickets mailing list