Skip to content

Speed up handling of large String literals

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
Trac metadata
Trac field Value
Version 8.6.3
Type Task
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information