Author: Joe Horn.
Here's a fun, useful and obvious program for your 48SX:

NAME   Description                In    ->     Out

TIMR   Level 1 object timer       obj   ->     ...  sec  obj

[# 4181h, 80 w/ name] -- see pg. 627 for character translations

\<< \-> p
  \<< MEM CLEAR TICKS p EVAL TICKS
      DEPTH ROLL - B\->R 8192 / 4 RND p
  \>>
\>>  @ end of TIMR

To use TIMR, place the object to be timed in level 1 and press TIMR.
  Note: if the object requires arguments, you must include them with
  it in a list or program.

Example:  How long does it take the 48SX to calculate the factorial
  of 253?  Place { 253 ! } in level 1, and press TIMR.  My 48SX says
  it takes .1119 seconds.  The object is left unchanged in level 1 so
  that you can press TIMR again (never trust a single timing!).  The
  result(s), if any, from the object in level 1, are found in level 3
  and up.  The rest of the stack is cleared.

Example: How long does it take the built-in summation function to add
  the numbers from 1 to 1000?  Try it: 'sigma(A=1,100,A)' and then
  press TIMR.  My 48SX takes about 14.746 seconds.  How long does a
  user-code program to do the same thing take?  Try this: << 1 2 1000
  FOR a a + NEXT >> then press TIMR.  It only takes 9.387 seconds!
  (Moral: avoid the summation function!  It's slow!)

Notes:  The MEM is used only to force the calculator to perform its
  "house cleaning" right away; we want to time the object, not
  extraneous calculator hiccups.  The CLEAR not only gets rid of this
  unneeded MEM value but also guarantees that the object is not
  slowed down by junk in the stack.  { TICKS p EVAL TICKS } is the
  heart of the routine; you can't get closer in time to evaluating
  the object than that.  Don't forget that local variables are never
  automatically evaluated; references to their names merely recall
  their contents to the stack.  Hence the necessity of the EVAL here.

joehorn@hpcvbbs.UUCP  or (714) 858-0920

P.S.  This program is obsoleted by the XTIME function in Donnelly's
      Tool Library.
