Building for Performance

Hi all,

Whilst I've been getting to grips with perspective bindings, I've noticed theres often multiple ways to achieve the same result. Taking a simple example, Which would be the most efficient way to perform the following:

A binding of the display parameter on label-1 to label-2, except it is required to be inverse?
The few ways that jump out are:

  1. Create a property binding, and add an expression transform as !{value}
  2. Create a property binding, and add an mapping transform with true > false and vice versa.
  3. Create an expression binding as !{path/to/prop}

Is there any one of these that is 'prefered' or more efficient?
The above is but a simple example. I'd love to see (or be pointed to as it no doubt exists) a guide on the best way to maximise performance of the system by design.

Have a great day!

Alex

1 Like

Maybe somebody has a guide, but I got some topics for you.

3 Likes

In this example, #3 is the most performant, though it could be argued that the performance gain in this instance would be negligible. Anytime you add an additional processing step you add latency.

In general for the best performance I follow these guidelines:

  • If you can achieve what you want with a binding, use a binding.
  • Always use the binding type that is the most direct. (e.g. if all you need is a binding to a property use a property binding, not an expression binding.)
  • Given the choice between an expression and a script, use an expression.
  • Minimize the amount of data that must travel between gateway and client.
  • Minimize the amount of duplicate data repeatedly sucked out of your database (caching, etc).
  • Minimize the amount of duplicate calculations done for multiple points of use
  • When scripting choose a Java import over a python import if available
  • When scripting use the NetBeans shortcuts where applicable
  • Keep global script data in top level variables in a project script rather than recreating it
  • When scripting tag reads and writes always combine them to as few function calls as possible.

I've picked these up from various posts on the forum over time. I keep a running list for quick reference (particularly for training) and add little golden nuggets when I see them.

A couple of links for references.

@PGriffith's assumptions about the performance of different binding transforms

NetBeans shortcuts are faster than the long form. For example if getting the column names from a dataset object use dataset.columnNames rather than dataset.getColumnNames()

13 Likes