I see it now. Thanks!
Milan
* Stavros Macrakis <macrakis at alum.mit.edu> [2007-04-12 12:40:12 -0400]:
> On 4/12/07, Milan Lukic <milan at eskimo.com> wrote:
> >
> > I am not sure that there is any advantage in defining Max and Min,
> >
> over already existing max, min functions in Maxima.
>
>
> In interpreted code, the hand-coded Max/Min are much faster, because they
> don't need the full generality of symbolic Max/Min. On the other hand, in
> compiled code, with appropriate declarations, max/min are just fine. Less:
> when performance matters, use appropriate declarations and compile.
>
> tt():=for i thru 300 do for j thru 300 do mm(i,j)$
> (mm needs to be a separate function, otherwise the "min" will
> be compiled with integer i/j)
> (tt always compiled)
> mm(i,j):=j$ (check overhead)
> interpreted/translated/compiled 1.34 / 0.58 / 0.50
> mm(i,j):=max(i,j)$
> 14.68 / 9.29 / 10.85
> mm(i,j):=(modedeclare([i,j],integer),max(i,j));
> 14.65 / 0.44 / 0.50
> mm(i,j):=if i>j then i else j$
> 2.63 / 0.69 / 0.22
> mm(i,j):=(modedeclare([i,j],integer), if i>j then i else j)$
> 4.66 / 0.22 / 0.50
>
> The overhead swamps the numbers in the compiled cases, except for undeclared
> max(i.j), so let's try thru 5000:
>
> tt():=for i thru 5000 do for j thru 5000 do mm(i,j)$
> mm(i,j):=(modedeclare([i,j],integer),max(i,j))$
> 10.03 300x faster per iteration than without declarations
> mm(i,j):=if i>j then i else j$
> 42.94 3x slower than max
> mm(i,j):=(modedeclare([i,j],integer),if i>j then i else j)$
> 6.82 1.3x faster than max
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
--