Hi!
Here is a short function for timing maxima evaluation:
----------------------
(in-package :maxima)
(defmspec $timing (args)
(let ((start-time (get-internal-run-time))
(result))
(setf result (meval (second args)))
(cons '(mlist simp)
`(,(/ (- (get-internal-run-time) start-time)
(float internal-time-units-per-second))
,result))))
-----------------------
As far as I know, maxima has no timing function (except the one which
prints out the result) yet... Perhaps this one should be improved and
added to maxima. It returns a maxima list with the first element
being the time elapsed in seconds (floating point number) and the
second being the result of expression. The reason I wrote this is,
that I can test how maxima functions behave with increasing N. The
precision on sbcl is around 10^-3 sec. The result seem to agree
precisely with 'showtime:true' as far as I tested. A simple example -
testing $table function:
--------
a:table([end,
timing(table(i,[i,end]))[1]],
[end,[10000, 20000, 30000, 50000, 100000, 200000, 500000, 1000000]]);
draw2d( points_joined = true, points(a), logy = false);
---------
The result is, that $table is linear in N, as is should be...
What I'm asking is, how to get best timing in common list (that works
on all implementations that maxima runs on), perhaps more precise
timing - I found (get-internal-run-time) while quickly looking
through Hyperspec.
Also if you needed timing in maxima, how would you implement it -
what do you need out of a timing function you would use yourself for
profiling your code or maxima functions? I copied the model for
$timing from Mathematica (as you've probably know - that's what I
like to do)..
Any thoughts on improvement of $timing or on alternative
implementation that does what you need for your timing needs in Maxima?
Regards,
Ziga Lenarcic