
CHAPTER 2: The ExtendScript Toolkit Code profiling for optimization 35
Switching between the functions in the call hierarchy allows you to trace how the current function was
called. The Console and Data Browser panels coordinate with the Call Stack panel. When you select a
function in the Call Stack:
X The Console panel switches its scope to the execution context of that function, so you can inspect and
modify its local variables. These would otherwise be inaccessible to the running JavaScript program
from within a called function.
X The Data Browser panel displays all data defined in the selected context.
Code profiling for optimization
The Profiling tool helps you to optimize program execution. When you turn profiling on, the JavaScript
engine collects information about a program while it is running. It counts how often the program
executed a line or function, or how long it took to execute a line or function. You can choose exactly which
profiling data to display.
Because profiling significantly slows execution time, the Profile menu offers these profiling options.
:
Off Profiling turned off. This is the default.
Functions The profiler counts each function call. At the end of execution, displays the total to
the left of the line number where the function header is defined.
Lines The profiler counts each time each line is executed. At the end of execution,
displays the total to the left of the line number.
Consumes more execution time, but delivers more detailed information.
Add Timing Info Instead of counting the functions or lines, records the time taken to execute each
function or line. At the end of execution, displays the total number of
microseconds spent in the function or line, to the left of the line number.
This is the most time-consuming form of profiling.
No Profiler Data When selected, do not display profiler data.
Comentarios a estos manuales