OL Learn

Designer template and scripts

Hi all,

I have some comprehension questions.
After trying to speed up a very complicated template, I noticed, that scripts for disabled sections still get evaluated and run.
So I made a simple template with 3 sections and a single variable in the data model. The variable is on every section with a single script.
Then I ran a script profiling for different cases. These are the results:

Case 1: 3 sections, 3 control scripts (1 section enabled), 1 var with text (w/o selector)
Name Count Elapsed (ms) Delta (ms)
Standard > test 60 64.30
Control > Section 1 0 13.25 -0.30
Control > Section 2 0 9.95 -0.30
Control > Section 3 0 9.67 -0.22
Total 97.18 +37.27

Case 2: 3 sections, 1 combined control script(1 section enabled), 1 var with text (w/o selector)
Name Count Elapsed (ms) Delta (ms)
Standard > test 60 63.84 -0.71
Control > Control 0 20.72 -0.38
Total 84.56 -1.09

Case 3: 3 sections, 1 combined control script(1 section enabled), 1 var with text and selector for the enabled section (html[Section=‘Section 2’])
Name Count Elapsed (ms) Delta (ms)
Standard > test 20 29.70 +3.90
Control > Control 0 20.84 +0.04
Total 50.54 +3.94

Case 4: 3 sections, 1 combined control script(1 section enabled), 1 var with text and selector for 1 enabled and 1 disabled section (html[Section=‘Section 2’],html[Section=‘Section 1’])
Name Count Elapsed (ms) Delta (ms)
Standard > test 40 54.90
Control > Control 0 21.02 +0.18
Total 75.92 +25.38

Case 5: 3 sections, 1 combined control script(1 section enabled), 1 var with text and selector for 1 enabled and 2 disabled section (html[Section=‘Section 2’],html[Section=‘Section 1’],html[Section=‘Section 3’])
Name Count Elapsed (ms) Delta (ms)
Standard > test 60 74.75
Control > Control 0 20.83 -0.19
Total 95.59 +19.66

Multiple Control scripts, doing the same thing as a single one, take longer. That’s ok. So I went from Case 1 to Case 2 saving some milliseconds.
Now my questions:

  • Why do scripts for disabled sections run, when the control script runs first (and disables the sections)? There is no way to re-enable a section after the control script, so evaluating the content is a waste…
  • Why do Case 2 and Case 5 differ in time resulting in the same layout?

Sorry for the long message and thanks!
best
-i.