Skip to content

3x slowdown on GHC HEAD with file containing lots of overloaded string literals

I just noticed that compiling xmlhtml-0.2.3.5 from Hackage takes an extraordinarily long time on GHC HEAD. The slowdown can be attributed to the Text.XmlHtml.HTML.Meta module. I've extracted it and tweaked it so that it requires no dependencies to build (I now use ByteString instead of Text, but the slowdowns for both types were about the same.)

On GHC 8.0.2, it takes about 3 seconds to compile the attached module:

$ /usr/bin/time /opt/ghc/8.0.2/bin/ghc -fforce-recomp TextXmlHtmlHTMLMeta.hs 
[1 of 1] Compiling Text.XmlHtml.HTML.Meta ( TextXmlHtmlHTMLMeta.hs, TextXmlHtmlHTMLMeta.o )
3.44user 0.07system 0:03.51elapsed 99%CPU (0avgtext+0avgdata 208480maxresident)k
0inputs+21688outputs (0major+43934minor)pagefaults 0swaps

But on GHC HEAD, it takes about 10 seconds:

$ /usr/bin/time ~/Software/ghc2/inplace/bin/ghc-stage2 -fforce-recomp TextXmlHtmlHTMLMeta.hs 
[1 of 1] Compiling Text.XmlHtml.HTML.Meta ( TextXmlHtmlHTMLMeta.hs, TextXmlHtmlHTMLMeta.o )
9.93user 0.11system 0:10.03elapsed 100%CPU (0avgtext+0avgdata 233656maxresident)k
0inputs+21464outputs (0major+54853minor)pagefaults 0swaps
Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information