Compiling native templates?

137 views
Skip to first unread message

Kamran Ayub

unread,
Apr 10, 2012, 5:47:07 PM4/10/12
to knock...@googlegroups.com
I have a large application, right now most templates are in the DOM but some re-usable ones are in script tags.

Would there be any benefit in pre-compiling all of these? Is there even such a thing for native templates? I could use jQuery Templates, but I miss the control-flow bindings. This will need to be a performant application and I know pre-compiled templates perform the best. I was hoping to pre-compile native templates instead of resorting to jQuery tmpl or Underscore.

Thoughts?

Michael Best

unread,
Apr 10, 2012, 8:54:21 PM4/10/12
to KnockoutJS
There no support for pre-compiling native templates. In Knockout 2.1,
inline templates will work faster by using cloneNode instead of
strings to save and display the templates.

Kamran Ayub

unread,
Apr 11, 2012, 7:55:46 AM4/11/12
to knock...@googlegroups.com
Will it be any better/faster for named templates or about the same? It
doesn't worry me too much, focusing on avoiding performance issues with the
view model will probably win out over native vs. named.

Michael Best

unread,
Apr 11, 2012, 5:29:16 PM4/11/12
to KnockoutJS
There are some performance improvements that will help named
templates, for example, caching the compiled bindings.

-- Michael
Reply all
Reply to author
Forward
0 new messages