[Date Index]
[Thread Index]
[Author Index]
Re: Slow Show/Graphics in v6.0
*To*: mathgroup at smc.vnet.net
*Subject*: [mg81115] Re: Slow Show/Graphics in v6.0
*From*: Alex Shvydky <ashv at lle.rochester.edu>
*Date*: Thu, 13 Sep 2007 06:22:24 -0400 (EDT)
*Organization*: University of Rochester
*References*: <200709050653.CAA26889@smc.vnet.net> <fc4iac$eh5$1@smc.vnet.net> <fc85p0$lh9$1@smc.vnet.net>
Thanks again for your input, Mark.
Apparently we disagree on some of the issues
(mostly because we use Mathematica differently
and for different purposes) and this is OK.
In the end we all would benefit if the
new version is faster, more robust, has more features,
makes nicer plots, etc. etc. etc.
>
>> Now, here is another trivial example:
>> Timing[
>> mr = 500;
>> mt = 500;
>> 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}];
>> ]
>> It takes 0.56 seconds in V5.2 and 4.703 seconds
>> in V6.0 (Why???? What now, is it the "front-end" again?)
>
> No, this is a PackedArray issue. You can tell
> by executing the following:
> Developer`PackedArrayQ[xar]
>
> V5.2 returns True, while V6 returns False.
> PackedArrays are largely handled internally
> and, evidentally, the rules as to when a
> PackedArray is automatically returned are a
> bit different. Perhaps a design flaw, although
> I would immediately make that judgement, since
> I don't know all the considerations that went
> into the decision.
Now that we know that the real issue in the above
example is that V5.2 automatically generate PackedArrays
and V6.0 does not, how can I force V6.0 to use
exclusively PackedArrays? I see no reason why it does not
automatically do it. Each element of the array is
Real.
>
> Incidentally, try setting mr=mt=249 and compare
> timings. Or try setting mr=mt=1000 and multiply
> by a symbolic expression inside the Table. You'll
> then find that the timings are quite comparable.
> Essentially, this slows 5.2 by forcing it to not
> use PackedArrays. You can similarly speed up
> the V6 code by forcing it to use PackedArrays.
Interestingly if mr=mt>=250 v5.2 uses
the PackedArrays, while if mr=mt<250
it uses regular arrays. This should have
been documented somewher (may be it was?)
Again, my question is how do I force
mathematica to always use the PackedArrays
(all of my arrays are real)?
I am not sure if you saw the other example
that ran on V6.0 about 10 times slower than on V5.2
(example is artificial as in reality finterp comes
from a table in a file generated by a FORTRAN program...):
profr[r_, s_] := E^(Log[0.05]*r^s);
fonebeam[th_, s_] := profr[Sin[th], s]*Max[0, Cos[th]];
lmax = 10;
Table[
finterp = 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}]
Alex
Prev by Date:
**Re: help plot log[f[t]] vs a parameter using an ODE**
Next by Date:
**Re: Anomolous behaviour of Penrose Triangle Demonstration**
Previous by thread:
**Re: Slow Show/Graphics in v6.0**
Next by thread:
**Using Inset as a primitive in Graphics3D**
| |