• Herbert Valerio Riedel's avatar
    Make `PackageName` type opaque (#3896) · dabd9d98
    Herbert Valerio Riedel authored
    When looking at heap-profiles of `cabal-install`, the `(:)` constructor
    stands out as the most-allocated constructor on the heap.
    
    Having to handle 10k+ package names contributes to the allocation
    numbers, especially on 64bit archs where ASCII `String`s have a 24 byte
    per character footprint.
    
    This commit is a preparatory commit to pave the way for changing
    `PackageName`'s internal representation to something like
    `ShortByteString` (which is essentially a thin wrapper around primitive
    `ByteArray#`s which themselves have have an overhead of 2 words + one
    byte per ASCII character rounded up to nearest word) which would allow
    to reduce the memory footprint by a full order of magnitude, as well as
    reduce pointer chasing and GC overhead.
    dabd9d98
IntegrationTests2.hs 16.3 KB