[GHC] #8472: Primitive string literals prevent optimization

GHC ghc-devs at haskell.org
Thu Sep 8 15:43:53 UTC 2016


#8472: Primitive string literals prevent optimization
-------------------------------------+-------------------------------------
        Reporter:  akio              |                Owner:  xnyhps
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.6.3
      Resolution:                    |             Keywords:  newcomer
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Runtime           |  (amd64)
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by gridaphobe):

 While working on Phab:D1259 I came across another example of this issue
 (NB it requires my patch to trigger). The idea in that patch is to avoid
 inlining `String` literals and share them as top-level values instead. In
 order to keep using the REWRITE rules, we pretend that `unpackCString#` is
 CONLIKE. This has a side-effect of making GHC float the unboxed string
 literal out into a separate let-binder, which then prevents us from
 floating the `unpackCString#` application to the top-level, as unboxed
 literals aren't allowed there.

 Here's a simple example that triggers the behavior with the Phab:D1259
 patch, but properly floats the `String`s on master.

 {{{
 module Foo where

 draw xs = a ++ b ++ xs
 [a,b] = ["aa", "bb"]
 }}}

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


More information about the ghc-tickets mailing list