Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Too much inlining #19

Closed
snoyberg opened this Issue · 7 comments

6 participants

@snoyberg

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

@snoyberg snoyberg referenced this issue in yesodweb/yesod
Closed

Too much inlining in Shakespeare? #298

@Shimuuar

One of problems is that literals produce too much code.

text :: T.Text
text = T.pack "text"
  Data.Text.Fusion.unstream
    (Data.Text.Fusion.Common.streamList
       @ GHC.Types.Char
       (GHC.Base.map
          @ GHC.Types.Char
          @ GHC.Types.Char
          Data.Text.Internal.safe
          (GHC.Base.unpackCString# "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
@tibbe

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

@jhance

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.

@bos bos was assigned
@bos
Owner
bos commented

I've fixed this in 2b2cb08. Working on backports to older versions of GHC now :-(

@bos
Owner
bos commented

Tagged and released from 6f64406.

@bos bos closed this
@meteficha

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.

@snoyberg snoyberg referenced this issue from a commit in yesodweb/shakespeare
@snoyberg snoyberg Conditionally turn off NOINLINE fix (bos/text#19) d23497b
@snoyberg snoyberg referenced this issue from a commit in yesodweb/persistent
@snoyberg snoyberg Conditionally turn off NOINLINE fix (bos/text#19) 5b2cc67
@snoyberg

@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!

@feuerbach feuerbach referenced this issue from a commit in signalvine/persistent-template
@snoyberg snoyberg Conditionally turn off NOINLINE fix (bos/text#19) 749d8cf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.