by John Brinkman
I enjoyed attending MAX last week. The best part was putting some faces to names of people who had previously been cyber-personalities.
We did a pre-conference lab on LiveCycle best practices. For the lab I prepared four exercises on various aspects of form design. For those who weren’t able to attend, I’ll post those exercises as a series of blog entries.
In this exercise we optimized a fairly simple script – a few lines in a loop. Depending on your machine, you should be able to improve the performance anywhere from a factor of three up to a factor of seven.
Open EX1 Performance Tests.pdf in Designer.
There are 50 subtotal values that need to be totaled. Each total has a test button that executes the Total script 500 times and measures the performance.
Note the 4 variations of the sum function:
- Test 1: The original (slow) version of the calculation
- Test 2: A copy of Test 1 that you will improve.
Look at the hints in the code comments in order to improve the script.
- Test 3: The solution
- Test4: Same calculation expressed in FormCalc
Understanding the solution:
- Undeclared variables are very expensive to reference
- Evaluate as few dots as possible. e.g. c.d is faster than a.b.c.d
Why is FormCalc faster?
FormCalc runs native in the XFA processor and there are no round-tripping costs.