Advanced performance techniques: best practice with expressions

For best performance, the following best practices are advised:

 

  • Where you have a property for which all cells need to be evaluated by same expression, use Fixed mode:

 

 

  • If you have properties you only want to evaluate occasionally, use the On Demand mode:

 

  • When performing maths, use node.math() rather than accessing node many times. Instead of:

(node.salary + node.bonus) * node.country.exchangerate

do:

node.math("(salary + bonus) * country.exchangerate")

  • When building strings via concatenation, use format rather than [].join(). For example, rather than:


[node.firstname, node.lastname].join(" ")

do:

node.format("{firstname} {lastname}")

  • For more advanced use cases, you can pass a lambda function as the second parameter:


node.format("{fullname} ({department})", n=>({
  fullname: n.fullname.value,
  department: n.department.coalesce("Unknown").value
}))

  • However, there is no inherent benefit of this (other than elegance) over:


[node.firstname, " (", n.department.coalesce("Unknown"), ")"].join("")

node.math() similarly accepts a lambda as the second parameter.

Have more questions? Submit a request

Comments