MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Bigger array taking less memory than smaller array

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27233] Re: Bigger array taking less memory than smaller array
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Tue, 13 Feb 2001 03:35:41 -0500 (EST)
  • References: <9686h9$3ps@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Sebastien

> This example disturbs me...
>
> ByteCount[Array[0 &, {20, 10}]]
>
> 4424
>
> ByteCount[Array[0 &, {30, 10}]]
>
>1260

The second array is big enough to be automatically converted to a packed
array internally, the first one is not.

First, repeat your input, giving  names to the arrays.

ByteCount[a1=Array[0&,{20,10}]]

    4424

ByteCount[a2=Array[0&,{30,10}]]

    1260

Check on which is a packed array.

Developer`PackedArrayQ[a1]

    False

Developer`PackedArrayQ[a2]

    True

Check on  the effect of being a packed array.

ByteCount[Developer`ToPackedArray[a1]]

860

ByteCount[Developer`FromPackedArray[a2]]

6624


--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

<Sebastien.deMentendeHorne at electrabel.com> wrote in message
news:9686h9$3ps at smc.vnet.net...
> Hi,
>
> This example disturbs me...
>
> In[233]:=
> ByteCount[Array[0 &, {20, 10}]]
>
> Out[233]=
> 4424
>
> In[234]:=
> ByteCount[Array[0 &, {30, 10}]]
>
> Out[234]=
> 1260
>
> Some considerations about this ?
>
> Sébastien de Menten de Horne      |    ELECTRABEL
> Tel:  ++32 10 48 51 76            |    R&D Energy Markets,
> Fax:  ++32 10 48 51 09            |    Traverse d'Esope, 6
> Gsm:  ++32 478 789 444            |    B-1348 Louvain-la-Neuve, BELGIUM
>




  • Prev by Date: Re: Palm OS Mathematica
  • Next by Date: Re: Urgent
  • Previous by thread: Re: Bigger array taking less memory than smaller array
  • Next by thread: Mathematica can talk!