Hi all Below are some handy timer functions for REBOL. The idea of tic and toc comes from the MATLAB numeric package. One advantage of using a pair of functions is that they can be placed most anywhere in a piece of code without modifying it (as is sometimes necessary with the time-block approach. I provide three implementations which differ in how the initial time is stored. example usage: >> tic loop 1000000 [sine 30] toc elapsed time: 0:00:02 >> The first approach is plain vanilla; the initial time is stored in a global variable. To minimize name conflicts, I gave it an unusual name: __t__. (feel free to be creative with this name) tic1: func [] [__t__: now/time exit] toc1: func [] [print ["elapsed time:" now/time - __t__]] In the second approach, the initial time is stored in a literal block in the body of the tic function, and then retrieved by toc. tic2: func [] [change [] now/time exit] toc2: func [] [print ["elapsed time:" now/time - first second second :tic2]] In the third approach, the initial time is stored in the body of the toc function which is created by tic. tic3: func [] [toc3: func [] compose/deep [print ["elapsed time:" now/time - (now/time)]]] Just choose the one you like and rename to plain tic and toc. Comments welcome! Larry
