Timing something

Discuss your code, get questions answered

Timing something

Postby oliver » Wed Apr 02, 2014 10:02 am

If you want to time/bench the execution of an RPL(+) program or JavaScript function, you can use Bench.RPL from the downloadable Bench folder.

Put any args your RPL(+) program takes and your RPL(+) program itself on the stack and type Bench.RPL on the command-line. (Do a Select All and Copy to retain the command in your paste buffer if you intend to repeatedly use it.)
The command will run your program and report the elapsed time when it finished running.

You don't have to put your RPL(+) program on the stack. You may as well simply create a new mini-RPL program that does nothing but call your RPL program. For example, if you stored your program as "speedTest" you may put ≪ speedTest ≫ on the stack and run Bench.RPL.

The same technique applies for timing a JS function. Just wrap its name in ≪ ≫.

The wrapping trick relies on a your program or function being stored in a variable. Using the actual program itself is advantageous if you're editing a RPL(+) program and want to time every iteration and want to skip the store step between edits.
Site Admin
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest