Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Slow Show/Graphics in v6.0

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81027] Re: Slow Show/Graphics in v6.0
  • From: Alex Shvydky <ashv at lle.rochester.edu>
  • Date: Sat, 8 Sep 2007 03:53:41 -0400 (EDT)
  • References: <fbljvd$qf5$1@smc.vnet.net> <fbqpr3$6hv$1@smc.vnet.net>

Hello David,
Thanks for the input!

I would have accepted the slow down If the difference
had been 2-3 times. But not 2 orders of magnitude!

In my example I have 350 by 350 grid and can easily discern
individual cells by expanding the plot across the whole
screen. So I do not think the example is "excessive"...

I remember seeing a similar (albeit not quite as dramatic)
slow down of graphics in 1992-3(?) when we upgraded from
v1.1 to v2.0 (or maybe from 2.0 to 2.2, can not remember)
The graphics became noticeably slower, but not 100 times to my
recollection.

Here is another purely numerical example:

  profr[r_, s_] := E^(Log[0.05]*r^s);
  fonebeam[th_, s_] := profr[Sin[th], s]*Max[0, Cos[th]];
  lmax = 10;
  Table[
      Interpolation[({#1, fonebeam[#1, s]} &) /@  Range[0, Pi,
  Pi/(30.*lmax)]];
      NIntegrate[finterp[th]*LegendreP[#1, Cos[th]]*Sin[th], {th, 0, Pi},
  MaxRecursion -> 16] & /@ Range[0, lmax],
  {s, 1.9, 3., 0.02}];

took 3.78sec in Mathematica V5.2 and 39.97sec in V6.0.


David Bailey wrote:
> Alex Shvydky wrote:
>> Hello,
>>
>> Just wanted to share my puzzlement (utter disappointment/
>> frastration) with a ridiculously slow speed of Show/Graphics
>> routines in the v6.0 of Mathematica as compared to 5.2,
>> which to me at this point makes v6.0 plain unusable.
>>
>> Working with hydrodynamic simulations I need to
>> visualize the computational grid. So I wrote
>> simple Mathematica routines to draw a simulation grid.
>> In 5.2 they worked fabulously for the past couple of
>> years.
>>
>> Here's an example.
>> First, set up two 2dimensional x- and y-coordinate
>> arrays.
>>
>> Timing[
>>    mr = 350;
>>    mt = 350;
>>    xar = Table[((ir - 1.)/(mr - 1.))*Cos[Pi*((it - 1.)/(mt - 1.))],
>>                {it, 1, mt}, {ir, 1, mr}];
>>    yar = Table[((ir - 1.)/(mr - 1.))*Sin[Pi*((it - 1.)/(mt - 1.))],
>>                {it, 1, mt}, {ir, 1, mr}];
>> ]
>>
>> In v6.0 it took
>> Out[3]= {2.312, Null}
>> In v5.2 it took
>> {0.281 Second, Null}
>>
>> Which is an order of magnitude difference, but hold on.
>> Now let's plot the mesh by simply constructing table
>> of edges of all the cells (I am aware that the algorithm
>> below is very unoptimized and can be made faster etc. etc.
>> It was not my intention to discuss here what should be the
>> fastest algorithm to plot a 2-d mesh,
>> nor was it my intention to debate the issue why one
>> would need to plot such a large mesh in the first place...,
>> but rather to compare the execution time for an IDENTICAL
>> code on v6.0 and v5.2. and get some confirmation/explanation
>> of such a suspiciously slow execution speed!).:
>>
>> Timing[
>> Show[
>>     Graphics[{Hue[0.7], AbsoluteThickness[0.1],
>> 	Table[{Line[{{xar[[it,ir]], yar[[it,ir]]},
>>                       {xar[[it,ir + 1]],yar[[it,ir + 1]]},
>>                       {xar[[it + 1,ir + 1]], yar[[it + 1,ir + 1]]},
>>                       {xar[[it + 1,ir]], yar[[it + 1,ir]]}}]},
>>          {ir, 1, mr - 1}, {it, 1, mt - 1}]
>>     }],
>> PlotRange -> {{-1, 1}, {0, 1}}, AspectRatio -> 1/2, Axes -> True, 
>> DisplayFunction -> $DisplayFunction, ImageSize -> 800]]
>>
>> While the timing as, it is returned by the Timing[] function,
>> is smaller in the v6.0:
>> {1.703, <Here goes the actual graphics>}
>> vs.
>> {2.094 Second, -Graphics-}
>> in v5.2
>>
>>
>> The actual cell evaluation time in v.6.0 is 124.11 seconds
>> vs. 2.22 seconds in v 5.2. ???!!!!!!!
>>
>> Could anybody please confirm this. Also it would be helpful
>> if someone from Wolfram Research would explain if
>> that is intended (unavoidable) by design or maybe
>> a simple setting (which I am unaware of) or a future patch
>> will be able to fix it.
>>
>> Also, it is horribly slow to resize the above graphics
>> in v5.2 you just grab the corned and drag. In v6.0 you
>> must do it 10-100 times slower (is it possible
>> that I just have a very poor graphics card?).
>>
>>
>> Thanks,
>> Alex Shvydky
>>
> 
> As an alternative to reverting to Mathematica 5.2, you could just use 
> the 5.2 graphics:
> 
> << Version5`Graphics`
> 
> This seems to work well with your example.
> 
> I have encountered something similar with some code that wrote a curve 
> containing a very large number of points of varying hue. The core of the 
> problem is that V6 graphics transfers the entire Graphics structure to 
> the frontend(FE) for rendering. If that expression is excessively 
> complicated, things get very slow. To be fair to WRI, I think in both 
> your case and mine, there was really far more detail than would actually 
> show - so the design decision to use the FE for rendering (which has a 
> lot of other advantages) was not so bad.
> 
> I solved my problem (without reverting to 5.2 graphics) by adding each 
> point to a Raster object (in the kernel) and transferring that to the 
> FE. Once I had remembered to pack the array (as Bret did in his 
> modification of your code) the result was quite acceptable.
> 
> David Bailey
> http://www.dbaileyconsultancy.co.uk
> 


  • Prev by Date: Re: Import from https: link in mathematica 6.0.1 on
  • Next by Date: Re: Re: Slow Show/Graphics in v6.0
  • Previous by thread: Re: Slow Show/Graphics in v6.0
  • Next by thread: Re: Slow Show/Graphics in v6.0