Timing, profiling...



-----Richard Fateman" wrote: -----

>The program simplus  (I think this is what Barton
>means by simp-add?)

Yes, I did mean simplus, not simp-add.

>implicitly does do a sort, but it is at best a
>quadratic-time algorithm like
>insertion sort. It might even be worse, in the
>sense that adding 2 sums of n
>and m items, it should do a merge, but probably
>just does n (or m)
>insertions, and might even unintentionally be
>n^3. Since the cost for
>comparisons ("great"), even repeated comparisons,
>is rather high, that is
>the other target for improvement.

To evaluate sum(a[i],i,1,n), Maxima calls
great n^3 / 6 - n / 6 times (experimentally determined).
Surely even a  simple-minded algorithm would be O(n^2).

Barton