Building for Performance

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()

17 Likes