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

Compl Yue compl.yue at gmail.com
Tue Jul 28 05:51:11 UTC 2020


I see, thanks! 

It's a relief, that huge overhead (as I wrongly perceived) really made me uncomfortable.

> On 2020-07-28, at 00:21, Oleg Grenrus <oleg.grenrus at iki.fi> wrote:
> 
> 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 <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,
>> 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 <http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe>
>> Only members subscribed via the mailman list are allowed to post.
> _______________________________________________
> 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/20200728/fd7cbd10/attachment.html>


More information about the Haskell-Cafe mailing list