[GHC] #16190: Speed up handling of large String literals

GHC ghc-devs at haskell.org
Wed Jan 16 09:55:02 UTC 2019


#16190: Speed up handling of large String literals
-------------------------------------+-------------------------------------
           Reporter:  hsyl20         |             Owner:  (none)
               Type:  task           |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.6.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The idea would to try the following optimization for literal strings by
 adding a pass in the simplifier that does:

 1. detect large string literals (> 2KB maybe? we would need to find a
 threshold)

 2. append large strings into a temporary binary file, remember their
 offset and size

 3. include the binary file into the compilation chain using ".incbin" in
 an assembler file (see the details here:
 https://hsyl20.fr/home/posts/2019-01-15-fast-file-embedding-with-
 ghc.html); add a fresh global module-specific symbol for the file, say
 "largestrings"

 4. replace `Lit (Literal (LitString LARGE_BYTESTRING))` expressions with
 `unpackNBytes# (plusAddr (CLabel "largestrings") offset) size`

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


More information about the ghc-tickets mailing list