Using the Script Profiler
The Script Profiler can help you identify the most costly lines of code in a stack. This can help you optimise your code by identifying inefficiencies.
To use the Script Profiler you open a stack, start the profiler and use the stack. When each line of a script in the stack is executed the execution time will be recorded. When the profiler is stopped a report is presented.
Note: The Script Profiler is available as part of the of the Pro Pack Addon for LiveCode.
Open the stack you want to profile
Open the stack you want to profile, and ensure it is the topStack.
Start the Script Profiler
Choose 'Start Profiling Scripts' from the Development menu, this will begin profiling the topStack.
Use the stack
Starting using the stack to begin the profile, when each line of a script in the stack is executed the execution time will be recorded.
In this example the actions I tool were
- Select 'Scrabble Solver'
- Enter the pattern "t???" to be matched
- Enter "a,r,d,y" as the available letters
- Click 'Search'
Stop the Script Profiler
To stop the Script Profiler select 'Stop Profiling Scripts' from the Development menu.
The Script Profile Report
When the Script Profiler is stopped a report is shown.
The report shows each line of script that was executed
- the line number
- number of times the line was called
- the time to execute the line
The total time in seconds is displayed at the bottom of the report.
Double clicking a line in the report will open the line of script in the Script Editor.
Alternative Ways to Start and Stop the Script Profiler
You can also start and stop the Script Profiler using the stack context menu, opened by ctrl/right clicking on the stack, or via the stack context menu in the Project Browser.
Add your comment