slowness is repeated Maxima evaluations?



2008/12/6 Robert Dodier <robert.dodier at gmail.com>

> On 12/6/08, David Joyner <wdjoyner at gmail.com> wrote:
>
> >  (1) Sage calls Maxima and asks it to do lots of definite integrals
> >  (about 30 in this case, each involving a sine or cosine) - these are the
> >  Fourier coefficients,
> >  (2) Sage multiplies each of these coefficients by a sine or cosine
> function
> >  and adds them up - call this finite sum f(x),
> >  (3) Sage calls Maxima to evaluate f(x) at lots of points to plot the
> graph
> >  (maybe 100 point-wise evaluations of f(x)),
> >  (4) calls matplotlib to create the plot of f.
>
> OK, I hope the following script (see PS) follows these steps.
>
> >  This was repeated (for timing purposes) 10 times. In an example
> involving
> >  about 30 terms, the first took about 10-11 seconds, and repeated
> >  evaluations took longer and longer, with the 10th taking about 30-35
> seconds.
>
> With the script as shown in the PS, I don't see an increase of
> run time over 100 iterations. It takes about 16 seconds (varies
> between 15.something to 17.something) with Maxima 5.17.0 + Clisp 2.46
> on CentOS Linux, 3.4 GHz Intel x86.


As I saw matplotlib/pylab being mentioned, in combination with slowdowns, I
thought I'd mention that plotting in pylab itself goes progressively slower.
On a system here, running the following:

import pylab
import time
n=300
m=100
for i in range(n):
    start=time.time()
    pylab.plot(range(m), [pylab.sin(pylab.pi*j/(m+0.0)) for j in range(m)])
    pylab.savefig("name%04i.eps"%i)
    print "plotting took %f sec"%(time.time()-start)


Will print "plotting took 0.051967 sec" for the second run (first goes
slower), but then the time to plot the next plots goes slowly up, to about
0.55 sec after 300 plots.

This is using Debian etch, python-matplotilb 0.87.7-0.3, python 2.4.