Plain handlebars templates


#1

There are situations where the view is rendered once and never updated. In this situation where binding is not needed, using plain handlebars templates ( not Ember.Handlebars ) is faster. The current challenge is that plain handlebars uses direct property access and I wasn’t able to change this behaviour to use Ember.get. Any ideas or suggestions would be greatly appreciated. hopefully there will be a plain handlebars template compiler to be used alongside the current template compiler.


#2

You might try the unbound and the (currently undocumented/private) unboundIf helpers. Since they don’t register observers, you may see some performance improvement, although how much I can’t say without a benchmark. The biggest downside is that your templates would no longer as portable (not that Ember templates necessarily are).


#3

@slindberg is right, use the unbound helpers. About the template compiler, I guess you can, but I dunno if it’s worth the maintenance, actually, since it’s gonna require a lot of fiddling around, the performance gains are probably not gonna be all that much, and htmlbars is coming out soon, so it’s probably best to way right now.


#4

The performance gains are significant. and the handlebars templates should be portable, since htmlbars may drop bind-attr.


#5

I’d like to see some numbers, there’s plenty of other ember magic that will cause performance losses, not just bound attributes.


#6

I meant that portability would be reduced simply due to needing to implement the unbound and unboundIf helpers in non-Ember contexts (which doesn’t sound like an issue for you). Good to know that the performance improvement is real!


#7

most of the performance gains of htmlbars come because it builds the dom, rather than building strings. don’t really see how selectively adding data-bindings is gonna help much there., You’re still using handlebars, so still slow. And anyway, does ember feel slow right now or something?