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

Oleg Grenrus oleg.grenrus at iki.fi
Mon Jul 27 16:21:58 UTC 2020


TL;DR bits, not bytes.

It meant to say 320 bit.

4 * 64 (Each Word32 is stored as Word64) + one 64bit header.

5 * 64 = 320.

It could be just 3 * 64 = 192.

- Oleg

On 27.7.2020 9.58, YueCompl via Haskell-Cafe wrote:
> Hello Cafe,
>
> I'm about to introduce UUID into my code, and
> see 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 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,
> Compl
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20200727/5f2fdcba/attachment.html>


More information about the Haskell-Cafe mailing list