1.4

comparatively time consuming. Avoid using such functions in a loop.
Note that the times vary slightly per run of the Script Profiler. Run the Script Profiler a number of
times and calculate an average from the results, before trying to speed up the execution of a
script.
Script Profiler settings
Number of runs
By default, the Script Profiler runs on 1000 instances of all the scripts. To test on a higher or
lower number of instances:
1. On the Window menu, click Preferences
2. Click Scripting
3. Set a number of iterations (maximum one billion) and click OK.
Sorting
In the Scripts Profiler, the scripts are by default sorted based on the values in the Elapsed
column, from high to low. Click any of the columns to sort the scripts according to the values in
that column.
Loading a snippet via a script
Instead of dragging it into the content directly, it is possible, and often very useful, to load a
snippet dynamically. Create a script (see "Write your own scripts" on page 195) and in the
code, use the following function:
results.loadhtml(‘snippets/nameofthesnippet.html)
This function will insert the snippet in the content at any position where the script's selector is
encountered.
For more examples, see Skin/Formats/CrossReferencePrintFormat("loadhtml() Global function
thatreplaces the content (inner html) of each matched element in the result set, alternatively
load the data into a variable.The location should be an URL or a relative file path. loadhtml
(location)loadhtml(location, selector) Loadhtml() iscached per batch run (based on the URL) in
Page 205