[Maxima] My $timing function...
ziga.lenarcic at gmail.com
Mon May 11 09:01:11 CDT 2009
On 11. May, 2009, at 3:52 PM, Richard Fateman wrote:
> You can call the primitive timing functions from Maxima directly as
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):
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...
More information about the Maxima