
#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