[Haskell-cafe] How to understand the 320-byte heap footprint of UUID ?

YueCompl compl.yue at icloud.com
Mon Jul 27 06:58:04 UTC 2020

Hello Cafe,

I'm about to introduce UUID into my code, and see https://github.com/haskell-hvr/uuid/issues/24 <https://github.com/haskell-hvr/uuid/issues/24> stating:

> Currently, UUID is represented as
data UUID  = UUID
         {-# UNPACK #-} !Word32
         {-# UNPACK #-} !Word32
         {-# UNPACK #-} !Word32
         {-# UNPACK #-} !Word32
> However, this suboptimal for 64bit archs (where GHC currently stores this a 320-byte Heap object); ...

According to https://wiki.haskell.org/GHC/Memory_Footprint <https://wiki.haskell.org/GHC/Memory_Footprint> I can understand each evaluated `Word32` on 64-bit hardware can take 2 words - 16 bytes, and given they are unpacked and strict, I think one whole UUID record should just take 64 bytes plus a few words, which is far less than 320 bytes. So how comes the 320 bytes?

Thanks with regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20200727/83ff38d1/attachment.html>

More information about the Haskell-Cafe mailing list