2022.2

Table Of Contents
Tip: Functionsthatactuallychangethecontentofthetemplate(forexample,append())arecom-
parativelytimeconsuming.Avoidusingsuchfunctionsinaloop.Formoretips,see"Optimizing
scripts"below.
NotethatthetimesvaryslightlyperrunoftheScriptProfiler.RuntheScriptProfileranumberoftimes
andcalculateanaveragefromtheresults,beforetryingtospeeduptheexecutionofascript.
Script Profiler settings
Number of runs
Bydefault,theScriptProfilerrunson1000instancesofallthescripts.Totestonahigherorlowernum-
berofinstances:
1. Onthemenu,selectWindow > Preferences.
2. ClickScripting.
3. Setanumberofiterations(maximumonebillion)andclickOK.
Sorting
IntheScriptsProfiler,thescriptsarebydefaultsortedbasedonthevaluesintheElapsedcolumn,
fromhightolow.Clickanyofthecolumnstosortthescriptsaccordingtothevaluesinthatcolumn.
Scripttimeout
Whentestingscripts,eitherbytogglingtoPreviewmodeorbyusingtheScriptProfiler,ascripttimeout
isactiveintheDesigner,sothatscriptsthatneedaverylongtimetorunarestoppedafterasettime.
Youcanadaptthistimeouttoyourneeds,asfollows:
1. Onthemenu,selectWindow > Preferences.
2. ClickScripting.
3. Setatimeoutinseconds(forexample:2s)andclickOK.Theminimumtimeoutis1second.
Note: Thescripttimeoutisnotactivewhengeneratingoutput.
Optimizing scripts
Intheprocessofoutputgeneration,theexecutionofscriptsmaytakeupmoretimethannecessary.To
optimizeatemplate,ithelpstodisablescriptsthatdon'thaveaneffectontheoutput;see"Managing
scripts"onpage814.
Thistopicpresentsanumberofotherwaystospeedupscriptexecutionbyoptimizingthescripts.
Page 820