• Sylvain Henry's avatar
    TH: support raw bytes literals (#14741) · 224a6b86
    Sylvain Henry authored
    GHC represents String literals as ByteString internally for efficiency
    reasons. However, until now it wasn't possible to efficiently create
    large string literals with TH (e.g. to embed a file in a binary, cf #14741):
    TH code had to unpack the bytes into a [Word8] that GHC then had to re-pack
    into a ByteString.
    This patch adds the possibility to efficiently create a "string" literal
    from raw bytes. We get the following compile times for different sizes
    of TH created literals:
    || Size || Before || After  || Gain ||
    || 30K  || 2.307s || 2.299  || 0%   ||
    || 3M   || 3.073s || 2.400s || 21%  ||
    || 30M  || 8.517s || 3.390s || 60%  ||
    Ticket #14741 can be fixed if the original code uses this new TH feature.
Last commit
Last update
GHCi Loading commit data...
LICENSE Loading commit data...
SizedSeq.hs Loading commit data...
changelog.md Loading commit data...
ghci.cabal.in Loading commit data...