[Maxima] tick and tock functions
robert.dodier at gmail.com
Wed Dec 27 19:36:26 CST 2006
On 12/27/06, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> Why would anyone want tick and tock rather than just time()?
(1) tick + tock return elapsed real time as well as estimated run time.
time only knows about estimated run time.
(2) tick + tock are not tied to output labels. time only knows about
time associated with an output label. When nolabels = true, time
doesn't know about anything.
Recently on the mailing list someone was trying to kludge together
a way to get timing info for partial results.
That was the inspiration for tick + tock.
If you have some alternative proposal I would be interested to hear it.
> Is it some perl idiosyncracy or something?
Perl is the source of much strangeness, but not this bit.
> Tick and tock are a strange interface to the clock. Why not just
> expose the clock itself, and let the user/programmer do the
get-internal-real-time acts differently in different Lisp systems
(because the initial time is one of those lovely implementation
dependencies in CL). tick + tock hide that. I don't like exposing
Lisp implmentation dependencies. But I guess it could be argued
that exposing get-internal-real-time is less ugly than tick + tock.
> The problem with tick and tock is that t0 is global, so you can't
> have nested calls; if you want partial times as well as full times,
> you have to accumulate them yourself, etc.
Yes, this is a problem.
> Also, why use rationals (with the cost of a GCD on every
> operation) rather than floats/bfloats?
get-internal-real-time and get-internal-run-time return integers.
Just carrying them over into Maxima preserves every bit,
which is in keeping with Maxima's general treatment of integers.
All the best,
More information about the Maxima