Skip to content

Explore putting persistent data structures into compact region

@AndreasK and @bgamari and I (and Hanue) pondered whether it would be worthwhile putting the ModDetails into a compact region. The note explains that the information doesn't change and is essentially a cache. Putting it into a compact region would reduce GC pressure.

It would also be potentially worthwhile to use fixed size arrays rather than lists for its fields.

There are probably other data structures which would benefit from the treatment, perhaps ModIface?


Update: 2020-03-24

A proof of concept that compacting is possible is present on this branch

Roadmap to Compacting a ModIface.

  • Use a type for FastString backed by an unpinned ByteArray to implement FastString (!1675 (closed)) (Owner @DanielG)
  • (Optional) Reduce allocations as a result of !1675 (closed) by using ShortByteString in more places rather than converting back to a pinned ByteString.
  • (Optional) Remove use of FastString from code gen, in order to be able to remove the cached length field and cached Z-encoded string from FastString. (!2949 (closed), owner @sgraf812)
  • Remove TyThing from WiredIn names, see (!2598 (closed), owner @mpickering )
  • Introduce IfaceLiteral type to remove the use of Type in Literal. (aa293b89, owner @mpickering)
  • Separate cache fields from the ModIface, they are functions so can't be compacted (dbe62229, owner @mpickering )
Edited by Sebastian Graf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information