MathGroup Archive 2008

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

Search the Archive

Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88116] Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*)
  • From: Alexey Popkov <popkov at gmail.com>
  • Date: Fri, 25 Apr 2008 05:28:42 -0400 (EDT)
  • References: <fupm2j$s4a$1@smc.vnet.net>

On 24 =C1=D0=D2, 14:06, "W_Craig Carter" <ccar... at mit.edu> wrote:
> (*let's use a do loop*)
> Timing[
> =9Aicount = 0;
> =9ADo[icount = icount + i, {i, 1, 10000000, 1}];
> =9Aicount
> =9A]
>
> (*this returns {10.2826, 50000005000000} on my machine.*)
> (*10.28 being a measure of how long the computation took to run*)
>
> (*lets try a table*)
> Timing[
> =9ATotal[Table[i, {i, 1, 10000000, 1}]]
> =9A]
>
> (*This returns {3.25516, 50000005000000} on my machine*)
>
> W. Craig Carter

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[]!


  • Prev by Date: HighlightedEdgeColors with Combinatoric`ShowGraph and AnimateGraph
  • Next by Date: Re: Re: Problem with RegionFunction
  • Previous by thread: Re: Re: Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*)
  • Next by thread: Re: Re: Print vs Print[text, Plot]? (*now Do and Table*)