Quickly determining how long it takes code to run
Before you analyze in depth the runtime performance of your code, have the method millisecondsToRun: display how long it takes to run the code. To do this, add millisecondsToRun: to a method shown in a browser and have the system print the elapsed time to the Transcript. The expressions you add to the method are as follows:
Transcript show: (
Time millisecondsToRun: [
<code>.
]) printString; cr.
When you run the code, the time it takes to run the code prints to the Transcript.
Or, if you can run the code from a Transcript, Workspace, or description pane:
1. Add the following to your code: Time millisecondsToRun: <code> ]
2. Using your mouse, mark the text.
3. From the Edit menu, select Display. The number of milliseconds it takes to run the code is displayed.
Last modified date: 01/29/2015