Re: Re: Print vs Print[text, Plot]? (*now Do and Table*)
- To: mathgroup at smc.vnet.net
- Subject: [mg88142] Re: [mg88116] Re: Print vs Print[text, Plot]? (*now Do and Table*)
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Sat, 26 Apr 2008 03:43:29 -0400 (EDT)
- References: <fupm2j$s4a$1@smc.vnet.net> <200804250928.FAA08139@smc.vnet.net>
Alexey Popkov wrote:
> [...]
> Hello,
> Lets try the following:
>
> mmu = MaxMemoryUsed[];
> Timing[icount = 0;
> Do[icount = icount + i, {i, 1, 10000000, 1}];
> icount]
> MaxMemoryUsed[] - mmu
>
> (*This returns
> {25.657, 50000005000000}
> 1118080
> on my machine*)
>
> mmu = MaxMemoryUsed[];
> Timing[Total[Table[i, {i, 1, 10000000, 1}]]]
> MaxMemoryUsed[] - mmu
>
> (*This returns
> {7.651, 50000005000000}
> 479959784
> on my machine but takes much more time because of using PAGEFILE*)
>
> 479959784/1118080=429.271
> Constructing Table takes 429 times more memory than using Do[]!
Of course it does! It has to hold all those numbers!
(Why are we shouting?)
Daniel Lichtblau
Wolfram Research
- References:
- Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*)
- From: Alexey Popkov <popkov@gmail.com>
- Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*)