Skip to content

Improve FastString memory behaviour

Daniel Gröber (dxld) requested to merge DanielG/ghc:short-bytestring into master

This PR changes the FastString implemetation to use ShortByteString instead of ByteString and removes the cache for lengthFS. It also pulls in the lazy z-encoding cache PR !1039 (closed).

There are multiple reasons we want this:

  • Fewe allocations: ByteString has 3 fields, ShortByteString just has one and removing fs_nchars removes another one.
  • ByteString memory is pinned:
    • This can cause fragmentation issues (see for example #13110) but also
    • makes using FastStrings in compact regions impossible.

cc @mpickering @bgamari

Edited by Daniel Gröber (dxld)

Merge request reports