[PD] Store data in memory more efficiently than in arrays

Roman Haefeli reduzent at gmail.com
Fri Jan 14 09:52:59 CET 2022


Hi IOhannes

Interesting side-notes. Thanks!
Roman

On Fri, 2022-01-14 at 09:11 +0100, IOhannes m zmoelnig wrote:
> 
> sidenote: of course we are not alone.
> take for example the most popular programming language¹ of the last
> few 
> years:
> a boolean value ideally requires a single bit to be stored
> accurately.
> now in python (tested on Python3.9 on a 64bit linux system), it
> doesn't 
> take 1 bit, or even 1 byte, but instead it takes 8 bytes.
> 
>  >>> sys.getsizeof([True]*3)-sys.getsizeof([True]*2)
> 8
> 
> at least, if you store the boolean in an array (a single boolean
> value 
> (outside of an array) has some extra metadata, that take 28 bytes in
> total)²
> 
>  >>> sys.getsizeof(True)
> 28
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20220114/ad5416d0/attachment.sig>


More information about the Pd-list mailing list