Performance questions / tips for bindings

Hi enyo masters,

A couple of questions on bindings and their performance.

1. Is it better to have one binding that sets content and classes on many objects via its transform function, or is it better to have multiple individual bindings to content and classes.

For example:
bindings:[<br />{from:".model", to:".null", transform: function(v,d,b){<br /><br />if (!v){return}<br />var raw = v.raw();<br />this.$.name.setContent(;<br />this.$.name.addClass(;<br />(plus 20 more setters!)<br /><br />return;<br />}}]<br />
bindings:[<br />{from:"", to:".$.name.content"},<br />{from:"", to:".$.name.classes"},<br />{+ 20 more bindings}<br />]<br />

2. does removing the "." in front of path really have a significant performance impact for approximately 200-300 bindings?



  • Are you discovering poor performance using individual bindings?
  • I have discovered poor performance but it may or may not be due to individual bindings :) Hence the question before I embark on a major code rewrite with regards to bindings (i.e., if there's not going to be much of a performance difference, maybe I should be looking somewhere else in my code!)
  • There is overhead with bindings; nothing is free after all. I'd suggest doing some profiling to see where time is being spent before refactoring. If you discover the quantity of bindings is an issue (tell us!), I'd suggest using a single observer on your kind rather than a binding transform to do the data mapping.
  • Bindings do have to explicitly remove the '.' if it's there. So, it is overhead. Best to fix it statically.
Sign In or Register to comment.