Comparison between binding syntax

when binding attributes to values, what is considered better? (performance, memory etc.)

placeholder="${placeholder}"

or:

placeholder.bind="placeholder"

is there any difference if the target of the binding is a native attribute, or a custom one?

(I want to bind a LOT (~10,000) of items, and I try to earn every bit possible.

1 Like

There are two sides:

  • initialization
  • update

They are not necessarily exclusive.

For initialization, placeholder.bind="placeholder" would be way faster: simpler binding initialization.

For update: would need real bench for this, but from following two relevant blocks: I would bet on normal binding.

That said, when you have 10k rows, things are going to be very difficult already

Can someone explain to me why with binding-expression we only update if newValue !== oldValue while with interpolation-expression we always update?

1 Like

How it looks like inside update target of interpolation expression https://github.com/aurelia/templating-binding/blob/f241548f9d0d630ef83989c0b33ee7dbfd26b5da/src/interpolation-binding-expression.js#L134-L144

You can see we always try to avoid update DOM unnecessarily. in binding expression, the position of the check is just different.

2 Likes