[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: clearsgets



Reply to note from "Avrom Fischer"  Thu, 2 Dec 2004
23:14:51 -0500

> I swim against a stopwatch every day and cannot imagine how you
> can accurately measure milliseconds, let alone seconds.

Since we're being picky tonight, you mean "seconds, let alone
milliseconds."

XyWrite 4 and later versions have a built-in stopwatch function.
Func ZT resets the internal timer to zero (and resumes timing);
VAriable $ET reports elapsed time. An XPL template for using these
functions looks like this:

ZT ;*; Reset timer (NotaBene expects ZT 0)
[do something];*;
>;*; Capture elapsed time
;*; Report elapsed time

This is a boon for programmers, because you can time alternate ways
of performing a task and choose the quickest way. But there's a
catch. Some XPL operations are so fast that even a timer calibrated
to the nearest hundredth of a second can't measure them. They slip
under the radar. What to do? Well, if once is too quick to
measure, why not repeat the operation 100 or 1000 times? That's the
idea behind a Jumbo U2 routine called ITER[ations]. You DeFine some
XPL code and issue a command like ITER 1000, and the
routine runs your code 1000 times and reports the elapsed time
(E/T). Dividing total E/T by the number of iterations yields a
rough-and-ready estimate of the E/T for one iteration.

ITER is a programmer's tool, but there's a U2 stopwatch routine
that's addressed to a general audience: TIMER. Usage is simple.
Command TIMER ON to start timing, and TIMER OFF to
report elapsed time. Use it to time... anything. Handy for lawyers
and other professionals who bill their time by the hundredth of a
second.

--
Carl Distefano
cld@xxxxxxxx