tl;dr: text package's pack function is creating huge chunks of code everywhere.
See Felipe's post to the cafe for more details: http://www.haskell.org/pipermail/haskell-cafe/2012-March/100162.html
One of problems is that literals produce too much code.
text :: T.Text
text = T.pack "text"
I think it could be solved with rewrite rule like that. It should be faster since it avoids lists creation and will produce way less code.
textLiteral :: Addr# → Text
textLiteral = ...
unstream (streamList (map safe (unpackCString# s))) → textLiteral
There used to be such a rule for ByteStrings, but it stopped working not too long ago. See this ticket: http://hackage.haskell.org/trac/ghc/ticket/5218
When GHC generates code for anything with non-ASCII characters, it uses unpackCStringUtf8#. It would be really nice if it used unpackCStringUtf8Len# though...
Working on a patch.
I've fixed this in 2b2cb08. Working on backports to older versions of GHC now :-(
Tagged and released from 6f64406.
Thanks a lot, @bos!
@snoyberg, we should remove those NOINLINE pack wrappers when building with the fixed text package in order to avoid converting from String every time.
Conditionally turn off NOINLINE fix (bos/text#19)
@meteficha Agreed, and done. It will be part of the 1.0 release. And I'll have the yesod-platform point to version 0.11.2.0 of text. Thanks again @bos!