Hi!
On 11. May, 2009, at 3:52 PM, Richard Fateman wrote:
> You can call the primitive timing functions from Maxima directly as
>
> ?get\-internal\-run\-time();
Yes, this is exactly the lisp function that is used in $timing and
also for 'showtime' and other timings in maxima. This function is
defined in hyperspec so it should work on all implementations -
therefore it is probably the best choice (though implementation
specific timings - if available - could be more precise I imagine).
> I don't know if this is documented anywhere.
> It is tricky to use in a function since you may want to time the
> evaluation of arguments to the function, as you realize.
>
> f(expression):= block ([start:?get\-internal\-run\-time()] , ....
> do something here....
Precisely the reason $timing must be defined in lisp with 'defmspec'
- to prevent argument evaluation. In maxima it is possible (but not
very handy) to do (with documented Maxima functions):
---------
start: elapsed_run_time();
expression;
runtime: elapsed_run_time() - start;
--------
It does what $timing does - but it's not very handy :) for quick
profiling of your or Maxima functions.
> but expression has already been evaluated before start...
>
> RJF
>
Regards,
Ziga Lenarcic