Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Nifty Function of the Day -- Stopwatch

From: andrew:martin:colenso:school at: 19-Aug-2003 16:40

I needed something quick to time Rebol expressions (a number of Rebol words that work together), and I didn't want to put surrounding brackets around the Rebol code (yes, I am lazy). So I came up with this: Stopwatch: func [Label [string!] Start [time!] Value [any-type!]] [ print [now/time/precise - Start Label] ] And I use it like: StopWatch "Rearranging" now/time/precise foreach [ID Student] Students [ foreach [Date Entry] Student [ foreach [Period Code] Entry [ insert tail Intersections reduce [ make pair! reduce [ index? find/only Dates_Periods reduce [Date Period] index? find IDs ID ] Code ] ] ] ] And it gives me results like: 0:00:00.56 Reading/writing file 0:01:07.615 Parsing 0:00:26.557 Rearranging 0:00:00.401 Saving files (Which indicates that my parsing function needs to be improved if I'm to make this software faster!) Andrew J Martin Attendance Officer & Information Systems Trouble Shooter Colenso High School Arnold Street, Napier. Tel: 64-6-8310180 ext 826 Fax: 64-6-8336759 http://colenso.net/scripts/Wiki.r?AJM http://www.colenso.school.nz/ DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally liable) for materials distributed to or acquired from user e-mail accounts. You can report any misuse of an e-mail account to our ICT Manager and the complaint will be investigated. (Misuse can come in many forms, but can be viewed as any material sent/received that indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate language and/or other issues described in our Acceptable Use Policy.) All outgoing messages are certified virus-free by McAfee GroupShield Exchange 5.10.285.0 Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]